app/soc/views/models/student_proposal.py
changeset 2008 33c7bd727f16
parent 2006 8b7b5bc9abe2
child 2011 c4e1aa9ac8ca
equal deleted inserted replaced
2007:56da71f13f3a 2008:33c7bd727f16
   658         given_score = score_at_rank - entity.score
   658         given_score = score_at_rank - entity.score
   659     else:
   659     else:
   660       # might be None (if Host or Developer is commenting)
   660       # might be None (if Host or Developer is commenting)
   661       reviewer = mentor
   661       reviewer = mentor
   662 
   662 
       
   663     # store the properties to update the proposal with
       
   664     properties = {}
       
   665 
   663     if reviewer and (not is_public) and (given_score is not 0):
   666     if reviewer and (not is_public) and (given_score is not 0):
   664       # if it is not a public comment and it's made by a member of the
   667       # if it is not a public comment and it's made by a member of the
   665       # organization we update the score of the proposal
   668       # organization we update the score of the proposal
   666       new_score = given_score + entity.score
   669       new_score = given_score + entity.score
   667 
       
   668       properties = {'score': new_score}
   670       properties = {'score': new_score}
   669 
   671 
       
   672     if comment or (given_score is not 0):
   670       # if the proposal is new we change it status to pending
   673       # if the proposal is new we change it status to pending
   671       if entity.status == 'new':
   674       if entity.status == 'new':
   672         properties['status'] = 'pending'
   675         properties['status'] = 'pending'
   673 
   676 
   674       # update the proposal with the new score
   677       # create the review entity
       
   678       self._createReviewFor(entity, reviewer, comment, given_score, is_public)
       
   679 
       
   680     if properties.values():
       
   681       # there is something to update
   675       self._logic.updateEntityProperties(entity, properties)
   682       self._logic.updateEntityProperties(entity, properties)
   676 
       
   677     # create the review entity
       
   678     if comment or (given_score is not 0):
       
   679       self._createReviewFor(entity, reviewer, comment, given_score, is_public)
       
   680 
   683 
   681     # redirect to the same page
   684     # redirect to the same page
   682     return http.HttpResponseRedirect('')
   685     return http.HttpResponseRedirect('')
   683 
   686 
   684   def reviewGet(self, request, context, params, entity, form,
   687   def reviewGet(self, request, context, params, entity, form,