Permalink
Browse files

Fix issue #2, only allow most recent rating for any particular set of…

… products

for a particular user.
  • Loading branch information...
1 parent 9dfa6ae commit 49bb6af241185d080e4fc61d96cabe1bae39fc95 @ddunbar committed Jun 18, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 robusta/ui/views.py
View
@@ -381,6 +381,12 @@ def add_tasting_rating(id):
products = data['products']
rating = data['rating']
+ # Delete any existing rating for this user, multi here is spurious but
+ # defensive.
+ current_app.db.ratings.remove({ 'tasting' : oid,
+ 'products' : products,
+ 'user' : user }, multi=True)
+
# Add the rating to the database.
current_app.db.ratings.insert({ 'tasting' : oid,
'products' : products,

0 comments on commit 49bb6af

Please sign in to comment.