Displaying 1 result from an estimated 1 matches for "smart_id".
Did you mean:
short_id
2006 Aug 03
2
calculating average ratings and other imponderables
Okay, this *should* be easy, but it isn''t, although I reserve the right to
smack myself upside the head if it is:
Assume that a smart has_many ratings, and a rating belongs_to a smart (the
models are fine). Each rating has a column smart_id.
Each smart, then, has many ratings, with a column called "rating" that is
an int (1-10).
I want to find, say, the ten smarts with the highest average rating.
Calculating an average is easy enough--once I know which smart I''m looking
at. But how do I find this on the fly?...