<%
templateSummary = students[0]['grade_summary']
%>
%for section in templateSummary['section_breakdown']:
<%
tooltip_str = section['detail']
# We are making header labels from the first student record. So for tool tip (title),
# I am processing this string ```section['detail']``` from student record and removing
# all student related data i.e marks, percentage etc to get only the title of homework.
if "=" in section['detail']:
tooltip_str = section['detail'][0: section['detail'].rfind('=')]
if "-" in tooltip_str:
tooltip_str = tooltip_str[0: tooltip_str.rfind('-')]
%>
${section['label']} |
%endfor
${_('Total')} |
<%def name="percent_data(fraction, label)">
<%
letter_grade = 'None'
if fraction > 0:
letter_grade = 'F'
for (grade, cutoff) in ordered_grades:
if fraction >= cutoff:
letter_grade = grade
break
data_class = "grade_" + letter_grade
%>
${ "{0:.0f}".format( 100 * fraction ) } |
%def>
%for student in students:
%for section in student['grade_summary']['section_breakdown']:
${percent_data( section['percent'], section['detail'] )}
%endfor
${percent_data( student['grade_summary']['percent'], _('Total'))}
%endfor
%endif