Re: Calculate and store the average rating

2008-12-28 Thread eldonp2
@Dave: It is not a 1-to1 as I would like each borrower to provide his own rating, and then compute the average ratings per book - to make recommendations for the highest rated books. Thanks for the example in the reply too. I will try out the SQL update shortly. @ Russ: Thanks too for the input

Re: Calculate and store the average rating

2008-12-27 Thread Russell Keith-Magee
On Sat, Dec 27, 2008 at 7:48 AM, eldonp2 wrote: > > Is there a way to calculate and store the average rating in this > example: It's not entirely clear which part of this problem you want help with. - Computing the average rating. The brute force approach would be to iterate over the relevant

Re: Calculate and store the average rating

2008-12-26 Thread Dave Dash
Hmm... this is slightly different... is BookRatings and Books 1 to 1? If I store these aggregates as part of the class that it's grouping by. Here's how I do it for restaurants: class RestaurantRating(models.Model): restaurant = models.ForeignKey(Restaurant) value = models.IntegerF