From de5fa56b191d37e1a6a2dd5bdb14e20d0a7c6091 Mon Sep 17 00:00:00 2001 From: ichuang Date: Sun, 31 Mar 2013 13:18:54 +0000 Subject: [PATCH] add dump of description of grading configuration to instructor dashboard --- lms/djangoapps/instructor/views.py | 51 +++++++++++++++++++ .../courseware/instructor_dashboard.html | 1 + 2 files changed, 52 insertions(+) diff --git a/lms/djangoapps/instructor/views.py b/lms/djangoapps/instructor/views.py index 671283db9f..9bae77e82b 100644 --- a/lms/djangoapps/instructor/views.py +++ b/lms/djangoapps/instructor/views.py @@ -208,6 +208,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', '') @@ -1120,3 +1124,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 'WeightedSubsectionsGrader' in str(course.grader.__class__): + 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 = '
%s
' % msg.replace('<','<') + return msg diff --git a/lms/templates/courseware/instructor_dashboard.html b/lms/templates/courseware/instructor_dashboard.html index 23329c837d..df1d081354 100644 --- a/lms/templates/courseware/instructor_dashboard.html +++ b/lms/templates/courseware/instructor_dashboard.html @@ -156,6 +156,7 @@ function goto( mode)

+