# HG changeset patch # User Sverre Rabbelier # Date 1240056422 0 # Node ID f6a1c141f51ef5fb7b7c74dfbb40d9d0cdc787cc # Parent 8e8b1f0ad87f3d6c3c6e18a58e984be048662193 Use proposal key instead of raw proposal Patch by: Sverre Rabbelier, Lennard de Rijk diff -r 8e8b1f0ad87f -r f6a1c141f51e app/soc/views/helper/list_info.py --- a/app/soc/views/helper/list_info.py Sat Apr 18 11:41:56 2009 +0000 +++ b/app/soc/views/helper/list_info.py Sat Apr 18 12:07:02 2009 +0000 @@ -22,20 +22,20 @@ ] -def getStudentProposalInfo(ranking, assigned_proposals): +def getStudentProposalInfo(ranking, proposals_keys): """Returns a function that returns information about the rank and assignment. Args: - ranking: dict with a mapping from Student Proposal to rank - assigned_proposals: list of proposals assigned a slot + ranking: dict with a mapping from Student Proposal key to rank + proposals_keys: list of proposal keys assigned a slot """ def wrapper(item, _): """Decorator wrapper method. """ - info = {'rank': ranking[item]} + info = {'rank': ranking[item.key()]} - if item in assigned_proposals: + if item.key() in proposals_keys: info['item_class'] = 'selected' else: info['item_class'] = 'normal' diff -r 8e8b1f0ad87f -r f6a1c141f51e app/soc/views/models/organization.py --- a/app/soc/views/models/organization.py Sat Apr 18 11:41:56 2009 +0000 +++ b/app/soc/views/models/organization.py Sat Apr 18 12:07:02 2009 +0000 @@ -209,6 +209,7 @@ """ from soc.logic.models.ranker_root import logic as ranker_root_logic + from soc.logic.models import student_proposal as sp_logic from soc.models import student_proposal from soc.views.helper import list_info as list_info_helper from soc.views.models import student_proposal as student_proposal_view @@ -272,14 +273,17 @@ # only when the program allows allocations # to be seen we should color the list if org_entity.scope.allocations_visible: - assigned_proposals = getProposalsToBeAcceptedForOrg(org_entity) + assigned_proposals = sp_logic.getProposalsToBeAcceptedForOrg(org_entity) # show the amount of slots assigned on the webpage context['slots_visible'] = True + ranking_keys = dict([(k.key(),v) for k,v in ranking.iteritems()]) + proposal_keys = [i.key() for i in assigned_proposals] + # update the prop_list with the ranking and coloring information - prop_list['info'] = (list_info_helper.getStudentProposalInfo(ranking, - assigned_proposals), None) + prop_list['info'] = (list_info_helper.getStudentProposalInfo(ranking_keys, + proposal_keys), None) # check if the current user is a mentor user_entity = user_logic.logic.getForCurrentAccount()