Commit 262050e4 by Calen Pennington

Merge pull request #1778 from MITx/feature/ichuang/add-dump-grades-config-to-instructor-dashboard

add dump of description of grading configuration to instructor dashboard
parents 1ce362de 3b371c17
......@@ -41,6 +41,7 @@ from xmodule.modulestore import Location
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import InvalidLocationError, ItemNotFoundError, NoPathToItem
from xmodule.modulestore.search import path_to_location
import xmodule.graders as xmgraders
import track.views
from .offline_gradecalc import student_grades, offline_grades_available
......@@ -208,6 +209,10 @@ def instructor_dashboard(request, course_id):
track.views.server_track(request, 'dump-answer-dist-csv', {}, page='idashboard')
return return_csv('answer_dist_{0}.csv'.format(course_id), get_answers_distribution(request, course_id))
elif 'Dump description of graded assignments configuration' in action:
track.views.server_track(request, action, {}, page='idashboard')
msg += dump_grading_context(course)
elif "Reset student's attempts" in action or "Delete student state for problem" in action:
# get the form data
unique_student_identifier = request.POST.get('unique_student_identifier', '')
......@@ -1122,3 +1127,50 @@ def compute_course_stats(course):
walk(course)
stats = dict(counts) # number of each kind of module
return stats
def dump_grading_context(course):
'''
Dump information about course grading context (eg which problems are graded in what assignments)
Very useful for debugging grading_policy.json and policy.json
'''
msg = "-----------------------------------------------------------------------------\n"
msg += "Course grader:\n"
msg += '%s\n' % course.grader.__class__
graders = {}
if isinstance(course.grader, xmgraders.WeightedSubsectionsGrader):
msg += '\n'
msg += "Graded sections:\n"
for subgrader, category, weight in course.grader.sections:
msg += " subgrader=%s, type=%s, category=%s, weight=%s\n" % (subgrader.__class__, subgrader.type, category, weight)
subgrader.index = 1
graders[subgrader.type] = subgrader
msg += "-----------------------------------------------------------------------------\n"
msg += "Listing grading context for course %s\n" % course.id
gc = course.grading_context
msg += "graded sections:\n"
msg += '%s\n' % gc['graded_sections'].keys()
for (gs, gsvals) in gc['graded_sections'].items():
msg += "--> Section %s:\n" % (gs)
for sec in gsvals:
s = sec['section_descriptor']
format = getattr(s, 'format', None)
aname = ''
if format in graders:
g = graders[format]
aname = '%s %02d' % (g.short_label, g.index)
g.index += 1
elif s.display_name in graders:
g = graders[s.display_name]
aname = '%s' % g.short_label
notes = ''
if getattr(s, 'score_by_attempt', False):
notes = ', score by attempt!'
msg += " %s (format=%s, Assignment=%s%s)\n" % (s.display_name, format, aname, notes)
msg += "all descriptors:\n"
msg += "length=%d\n" % len(gc['all_descriptors'])
msg = '<pre>%s</pre>' % msg.replace('<','&lt;')
return msg
......@@ -156,6 +156,7 @@ function goto( mode)
<p>
<input type="submit" name="action" value="Download CSV of answer distributions">
<input type="submit" name="action" value="Dump description of graded assignments configuration">
</p>
<hr width="40%" style="align:left">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment