Forum OpenACS Q&A: Moving Along!

Collapse
27: Moving Along! (response to 1)
Posted by Dean Des Rosiers on
I wrote a bunch of SQL today.  It all executes, which is nice.  i haven't tested my functions yet, though.

I have two questions today.  The first concerns my relationships.  Essentially there is one relationship among three participants.  A 'rating' is what a 'user' assigns to an 'object' in a given 'dimension.'

To me it looks like one of those three participants winds up as an attribute, which doesn't feel right at all.  As of today, I have the relationship 'gr_rating' set up between 'user' and 'acs_object.'  I manually put the dimension_id in the 'gr_ratings' table after my call to acs_rel__new().  Is this quite good enough?

My other question is more down-to-earth.  I'd like to check that the rating passed in to the system is between the max_rating and min_rating for the given dimension.  Which is best: to use logic in a function or to create a rule in the db?  A check won't work in PostgreSQL - no sub queries in there.