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

Re: Calculate and store the average rating

2008-12-27 Thread Russell Keith-Magee
On Sat, Dec 27, 2008 at 7:48 AM, eldonp2 <eldo...@gmail.com> 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

Re: Calculate and store the average rating

2008-12-26 Thread Dave Dash
ven't used this in production yet. Let me know if this works for you. On Dec 26, 4:48 pm, eldonp2 <eldo...@gmail.com> wrote: > Is there a way to calculate and store the average rating in this > example: > > RATING_CHOICES = { >  '3' : 'Excellent', >  '2' : 'Good', >

Calculate and store the average rating

2008-12-26 Thread eldonp2
Is there a way to calculate and store the average rating in this example: RATING_CHOICES = { '3' : 'Excellent', '2' : 'Good', '1' : 'Poor', } class Loan( ... book = models.ForeignKey(Book) rating = models.IntegerField(choices=RATING_CHOICES) ... class BookRatings(... ... book