From 1593a27922d280d8a7272a942f3b1f6c8c96cb46 Mon Sep 17 00:00:00 2001 From: Lennard de Rijk Date: Mon, 6 Apr 2009 21:05:30 +0000 Subject: [PATCH] Added simple listing (no score, rank) for Student Proposals you are a mentor for. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed --- app/soc/views/models/organization.py | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/app/soc/views/models/organization.py b/app/soc/views/models/organization.py index d9564f5a..a359b146 100644 --- a/app/soc/views/models/organization.py +++ b/app/soc/views/models/organization.py @@ -61,9 +61,9 @@ class View(group.View): Params: original_params: a dict with params for this View """ - + from soc.views.models import program as program_view - + rights = access.Checker(params) rights['any_access'] = ['allow'] rights['show'] = ['allow'] @@ -275,6 +275,28 @@ class View(group.View): prop_list['info'] = (list_info_helper.getStudentProposalInfo(ranking, assigned_proposals), None) + # check if the current user is a mentor + user_entity = user_logic.logic.getForCurrentAccount() + + fields = {'user': user_entity, + 'scope': org_entity,} + mentor_entity = mentor_logic.logic.getForFields(fields, unique=True) + + if mentor_entity: + mp_params = list_params.copy() # proposals mentored by current user + + description = ugettext('List of %s sent to %s you are mentoring') % ( + mp_params['name_plural'], org_entity.name) + mp_params['list_description'] = description + mp_params['list_action'] = (redirects.getReviewRedirect, mp_params) + + filter = {'org': org_entity, + 'mentor': mentor_entity, + 'status': 'pending'} + + mp_list = lists.getListContent( + request, mp_params, filter, idx=1, need_content=True) + new_params = list_params.copy() # new proposals new_params['list_description'] = 'List of new %s sent to %s ' % ( new_params['name_plural'], org_entity.name) @@ -285,7 +307,7 @@ class View(group.View): contents = [] new_list = lists.getListContent( - request, new_params, filter, idx=1, need_content=True) + request, new_params, filter, idx=2, need_content=True) ip_params = list_params.copy() # ineligible proposals @@ -299,7 +321,7 @@ class View(group.View): 'status': 'invalid'} ip_list = lists.getListContent( - request, ip_params, filter, idx=1, need_content=True) + request, ip_params, filter, idx=3, need_content=True) # fill contents with all the needed lists if new_list != None: @@ -307,6 +329,9 @@ class View(group.View): contents.append(prop_list) + if mentor_entity and mp_list != None: + contents.append(mp_list) + if ip_list != None: contents.append(ip_list) -- 2.11.4.GIT