Added columns to the manage project page that show the amount of evaluations.
The total possible amount of evaluations that is shown is based on surveys which have at least one Record.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/student_project/list/heading_manage.html Tue Jul 28 11:23:11 2009 +0200
@@ -0,0 +1,8 @@
+<tr align="left">
+ <th class="first" align="right">Student</th>
+ <th>Title</th>
+ <th>Mentor</th>
+ <th>Mentor Evaluations (on file/total)</th>
+ <th>Student Evaluations (on file/total)</th>
+ <th>Status</th>
+</tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/student_project/list/row_manage.html Tue Jul 28 11:23:11 2009 +0200
@@ -0,0 +1,20 @@
+<tr class="off" onmouseover="this.className='on'; do_redirect=true" onmouseout="this.className='off'"
+onclick="if (do_redirect) document.location.href='{{ list.redirect }}'" name="name">
+ <td align="right"><div class="name"><a class="noul" onclick="do_redirect=false"
+ href="{{ list.redirect }}">{{ list.item.student.name }}</a>
+ </div>
+ </td>
+ <td><div class="title">{{ list.item.title }}</a></div></td>
+ <td><div class="name">{{ list.item.mentor.name }}</a></div></td>
+ <td><div class="count">
+ {{ list.info.grading_project_surveys_completed }}
+ /
+ {{ list.info.grading_project_surveys_total }}
+ </a></div></td>
+ <td><div class="count">
+ {{ list.info.project_surveys_completed }}
+ /
+ {{ list.info.project_surveys_total }}
+ </a></div></td>
+ <td><div class="status">{{ list.item.status }}</a></div></td>
+</tr>
--- a/app/soc/views/helper/list_info.py Tue Jul 28 11:20:42 2009 +0200
+++ b/app/soc/views/helper/list_info.py Tue Jul 28 11:23:11 2009 +0200
@@ -31,7 +31,7 @@
"""
def wrapper(item, _):
- """Decorator wrapper method.
+ """Wrapper method.
"""
info = {'rank': ranking[item.key()]}
@@ -42,3 +42,56 @@
return info
return wrapper
+
+
+def getStudentProjectSurveyInfo(program_entity):
+ """Returns a function that returns information used in a Student Project
+ table to show how many evaluations have been available and how
+ many have been taken.
+
+ Args:
+ program_entity: the program to check the total amount of
+ (Grading)ProjctSurveys for
+ """
+
+ from soc.logic.models.survey import grading_logic as grading_survey_logic
+ from soc.logic.models.survey import project_logic as project_survey_logic
+
+ fields = {'scope_path': program_entity.key().id_or_name()}
+
+ # count the number of have been active ProjectSurveys
+ project_surveys = project_survey_logic.getForFields(fields)
+ project_survey_count = len(project_surveys)
+
+ for project_survey in project_surveys:
+ if not project_survey_logic.hasAtLeastOneRecord(project_survey):
+ project_survey_count = project_survey_count - 1
+
+ # count the number of have been active GradingProjectSurveys
+ grading_surveys = grading_survey_logic.getForFields(fields)
+ grading_survey_count = len(grading_surveys)
+
+ for grading_survey in grading_surveys:
+ if not grading_survey_logic.hasAtLeastOneRecord(grading_survey):
+ grading_survey_count = grading_survey_count - 1
+
+ def wrapper(item, _):
+ """Wrapper method.
+ """
+
+ from soc.logic.models.survey_record import grading_logic
+ from soc.logic.models.survey_record import project_logic
+
+ fields = {'project': item}
+
+ # count the amount of records we have on store for this project
+ project_record_count = project_logic.getQueryForFields(fields).count()
+ grading_record_count = grading_logic.getQueryForFields(fields).count()
+
+ info = {'project_surveys_total': project_survey_count,
+ 'project_surveys_completed': project_record_count,
+ 'grading_project_surveys_total': grading_survey_count,
+ 'grading_project_surveys_completed': grading_record_count}
+
+ return info
+ return wrapper
--- a/app/soc/views/models/student_project.py Tue Jul 28 11:20:42 2009 +0200
+++ b/app/soc/views/models/student_project.py Tue Jul 28 11:23:11 2009 +0200
@@ -137,6 +137,10 @@
new_params['edit_template'] = 'soc/student_project/edit.html'
new_params['manage_template'] = 'soc/student_project/manage.html'
+ new_params['manage_overview_heading'] = \
+ 'soc/student_project/list/heading_manage.html'
+ new_params['manage_overview_row'] = \
+ 'soc/student_project/list/row_manage.html'
params = dicts.merge(params, new_params)
@@ -479,6 +483,8 @@
For params see base.View().public()
"""
+ from soc.views.helper import list_info
+
# make sure the organization exists
org_entity = org_logic.getFromKeyNameOr404(kwargs['scope_path'])
fields = {'scope': org_entity}
@@ -489,6 +495,10 @@
context['page_name'] = '%s %s' % (page_name, org_entity.name)
list_params = params.copy()
+ list_params['list_heading'] = params['manage_overview_heading']
+ list_params['list_row'] = params['manage_overview_row']
+ list_params['list_info'] = (
+ list_info.getStudentProjectSurveyInfo(org_entity.scope), None)
#list all active projects
fields['status'] = 'accepted'