Placing a public review via the review interface now also triggers the status change to pending.
authorLennard de Rijk <ljvderijk@gmail.com>
Wed, 25 Mar 2009 15:20:01 +0000
changeset 2008 33c7bd727f16
parent 2007 56da71f13f3a
child 2009 b060d531b5d7
Placing a public review via the review interface now also triggers the status change to pending. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/views/models/student_proposal.py
--- a/app/soc/views/models/student_proposal.py	Wed Mar 25 15:16:50 2009 +0000
+++ b/app/soc/views/models/student_proposal.py	Wed Mar 25 15:20:01 2009 +0000
@@ -660,23 +660,26 @@
       # might be None (if Host or Developer is commenting)
       reviewer = mentor
 
+    # store the properties to update the proposal with
+    properties = {}
+
     if reviewer and (not is_public) and (given_score is not 0):
       # if it is not a public comment and it's made by a member of the
       # organization we update the score of the proposal
       new_score = given_score + entity.score
-
       properties = {'score': new_score}
 
+    if comment or (given_score is not 0):
       # if the proposal is new we change it status to pending
       if entity.status == 'new':
         properties['status'] = 'pending'
 
-      # update the proposal with the new score
-      self._logic.updateEntityProperties(entity, properties)
+      # create the review entity
+      self._createReviewFor(entity, reviewer, comment, given_score, is_public)
 
-    # create the review entity
-    if comment or (given_score is not 0):
-      self._createReviewFor(entity, reviewer, comment, given_score, is_public)
+    if properties.values():
+      # there is something to update
+      self._logic.updateEntityProperties(entity, properties)
 
     # redirect to the same page
     return http.HttpResponseRedirect('')