]> git.openstreetmap.org Git - osqa.git/commitdiff
Resolves Jira OSQA-682, do not use the MAX_VOTES_PER_DAT setting, but the can_vote_co...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 16 May 2011 18:18:57 +0000 (18:18 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 16 May 2011 18:18:57 +0000 (18:18 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1039 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/commands.py
forum/views/users.py

index 630e0ef88842547da78263a5d45cab05f7f900c0..aeb01e54b2a387d3a8795cf30cb83ef0b8a2bc28 100644 (file)
@@ -73,6 +73,7 @@ def vote_post(request, id, vote_type):
         raise NotEnoughRepPointsException(vote_type == 'up' and _('upvote') or _('downvote'))
 
     user_vote_count_today = user.get_vote_count_today()
+    user_can_vote_count_today = user.can_vote_count_today()
 
     if user_vote_count_today >= user.can_vote_count_today():
         raise NotEnoughLeftException(_('votes'), str(settings.MAX_VOTES_PER_DAY))
@@ -104,7 +105,7 @@ def vote_post(request, id, vote_type):
     }
     }
 
-    votes_left = (int(settings.MAX_VOTES_PER_DAY) - user_vote_count_today) + (vote_type == 'none' and -1 or 1)
+    votes_left = (user_can_vote_count_today - user_vote_count_today) + (vote_type == 'none' and -1 or 1)
 
     if int(settings.START_WARN_VOTES_LEFT) >= votes_left:
         response['message'] = _("You have %(nvotes)s %(tvotes)s left today.") % \
index d532baf20b70bf3cdd9bb8e051b369ec3e803de9..9dbde3eaf179808ef54e939ed613d555a0d65e5a 100644 (file)
@@ -306,7 +306,7 @@ def user_profile(request, user):
     up_votes = user.vote_up_count\r
     down_votes = user.vote_down_count\r
     votes_today = user.get_vote_count_today()\r
-    votes_total = int(settings.MAX_VOTES_PER_DAY)\r
+    votes_total = users.can_vote_count_today()\r
 \r
     user_tags = Tag.objects.filter(Q(nodes__author=user) | Q(nodes__children__author=user)) \\r
         .annotate(user_tag_usage_count=Count('name')).order_by('-user_tag_usage_count')\r