-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
Raw scores and max points are more useful to instructors in the remote gradebook than the calculated scores sent now. Fixes #36 @pdpinch
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,11 +87,11 @@ def test_grade_summary_data(self): | |
], | ||
'data': [ | ||
[ | ||
1, u'u1', u'username', u'[email protected]', '', 0.0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
1, u'u1', u'username', u'[email protected]', '', (0.0, 1.0), 0, 0, 0, 0, 0, 0, 0, 0, | ||
0, 0, 0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | ||
], | ||
[ | ||
2, u'u2', u'username', u'[email protected]', '', 0.3333333333333333, 0, 0, 0, | ||
2, u'u2', u'username', u'[email protected]', '', (1.0, 3.0), 0, 0, 0, | ||
0, 0, 0, 0, 0, 0, 0, 0, 0.03333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
0, 0, 0, 0, 0 | ||
] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
import requests | ||
import urllib | ||
|
||
from collections import defaultdict, OrderedDict | ||
from collections import defaultdict, OrderedDict, Counter | ||
from markupsafe import escape | ||
from requests.status_codes import codes | ||
from StringIO import StringIO | ||
|
@@ -241,19 +241,30 @@ def domatch(student): | |
if not aname: | ||
msg += "<font color='red'>{text}</font>".format(text=_("Please enter an assignment name")) | ||
else: | ||
allgrades = get_student_grade_summary_data(request, course, get_grades=True, use_offline=use_offline) | ||
allgrades = get_student_grade_summary_data( | ||
request, | ||
course, | ||
get_grades=True, | ||
use_offline=use_offline, | ||
get_score_max=True | ||
) | ||
if aname not in allgrades['assignments']: | ||
msg += "<font color='red'>{text}</font>".format( | ||
text=_("Invalid assignment name '{name}'").format(name=aname) | ||
) | ||
else: | ||
aidx = allgrades['assignments'].index(aname) | ||
datatable = {'header': [_('External email'), aname]} | ||
datatable = {'header': [_('External email'), aname, _('max_pts')]} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
noisecapella
|
||
ddata = [] | ||
for student in allgrades['students']: # do one by one in case there is a student who has only partial grades | ||
try: | ||
ddata.append([student.email, student.grades[aidx]]) | ||
except IndexError: | ||
# do one by one in case there is a student who has only partial grades | ||
for student in allgrades['students']: | ||
if len(student.grades) >= aidx and student.grades[aidx] is not None: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
noisecapella
|
||
ddata.append( | ||
[student.email, | ||
student.grades[aidx][0], | ||
student.grades[aidx][1]] | ||
) | ||
else: | ||
log.debug(u'No grade for assignment %(idx)s (%(name)s) for student %(email)s', { | ||
"idx": aidx, | ||
"name": aname, | ||
|
@@ -755,8 +766,16 @@ def get_student_grade_summary_data(request, course, get_grades=True, get_raw_sco | |
for score in gradeset['raw_scores']: | ||
add_grade(score.section, getattr(score, 'earned', score[0])) | ||
else: | ||
category_cnts = Counter() | ||
for grade_item in gradeset['section_breakdown']: | ||
add_grade(grade_item['label'], grade_item['percent']) | ||
category = grade_item['category'] | ||
try: | ||
earned = gradeset['totaled_scores'][category][category_cnts[category]].earned | ||
possible = gradeset['totaled_scores'][category][category_cnts[category]].possible | ||
add_grade(grade_item['label'], earned, possible=possible) | ||
except (IndexError, KeyError): | ||
add_grade(grade_item['label'], grade_item['percent']) | ||
category_cnts[category] += 1 | ||
student.grades = gtab.get_grade(student.id) | ||
|
||
data.append(datarow) | ||
|
We don't want to normalize the names of columns, they need to be exactly the same so that we can use them in lmod_proxy and pylmod