app/soc/views/models/student_proposal.py
changeset 1741 0da1285f5bc0
parent 1715 3ec1a9518452
child 1752 255117ccd6a0
--- a/app/soc/views/models/student_proposal.py	Sun Mar 08 13:11:49 2009 +0000
+++ b/app/soc/views/models/student_proposal.py	Sun Mar 08 13:14:28 2009 +0000
@@ -254,12 +254,12 @@
     """See base.View._public().
     """
 
+    from soc.logic.models.review import logic as review_logic
+
     context['student_name'] = entity.scope.name()
 
-    if entity.mentor:
-      context['mentor_name'] = entity.mentor.name()
-    else:
-      context['mentor_name'] = "No mentor assigned"
+    context['public_reviews'] = review_logic.getReviewsForEntity(entity,
+        is_public=True, order=['created'])
 
   @decorators.merge_params
   @decorators.check_access
@@ -555,20 +555,16 @@
     # TODO(ljvderijk) listing of total given scores per mentor
     # a dict with key as role.user ?
 
-    # get the public reviews
-    fields = {'scope': entity,
-              'is_public': True}
+    # order the reviews by ascending creation date
+    order = ['created']
 
-    order = ['modified']
-
-    query = review_logic.getQueryForFields(filter=fields, order=order)
-    context['public_reviews'] = review_logic.getAll(query)
+    # get the public reviews
+    context['public_reviews'] = review_logic.getReviewsForEntity(entity,
+        is_public=True, order=order)
 
     # get the private reviews
-    fields['is_public'] = False
-
-    query = review_logic.getQueryForFields(filter=fields, order=order)
-    context['private_reviews'] = review_logic.getAll(query)
+    context['private_reviews'] = review_logic.getReviewsForEntity(entity,
+        is_public=False, order=order)
 
     # which button should we show to the mentor?
     if mentor: