From f23bf85199f217bbf03899d8f05779f571ca7e7d Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Wed, 19 Dec 2012 11:44:32 -0500 Subject: [PATCH 1/3] Added config to grader to hide averages of pset scores. --- common/lib/xmodule/xmodule/course_module.py | 3 ++- common/lib/xmodule/xmodule/graders.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 3506c72bd7..5384bfa90a 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -100,7 +100,8 @@ class CourseDescriptor(SequenceDescriptor): """Parse the policy specified in policy_str, and save it""" try: self._grading_policy = load_grading_policy(policy_str) - except: + except Exception, err: + log.exception('Failed to load grading policy:') self.system.error_tracker("Failed to load grading policy") # Setting this to an empty dictionary will lead to errors when # grading needs to happen, but should allow course staff to see diff --git a/common/lib/xmodule/xmodule/graders.py b/common/lib/xmodule/xmodule/graders.py index 8f885dc9d2..a183cec98b 100644 --- a/common/lib/xmodule/xmodule/graders.py +++ b/common/lib/xmodule/xmodule/graders.py @@ -316,7 +316,7 @@ class AssignmentFormatGrader(CourseGrader): min_count = 2 would produce the labels "Assignment 3", "Assignment 4" """ - def __init__(self, type, min_count, drop_count, category=None, section_type=None, short_label=None, show_only_average=False, starting_index=1): + def __init__(self, type, min_count, drop_count, category=None, section_type=None, short_label=None, show_only_average=False, hide_average=False, starting_index=1): self.type = type self.min_count = min_count self.drop_count = drop_count @@ -325,6 +325,7 @@ class AssignmentFormatGrader(CourseGrader): self.short_label = short_label or self.type self.show_only_average = show_only_average self.starting_index = starting_index + self.hide_average = hide_average def grade(self, grade_sheet, generate_random_scores=False): def totalWithDrops(breakdown, drop_count): @@ -385,7 +386,8 @@ class AssignmentFormatGrader(CourseGrader): if self.show_only_average: breakdown = [] - breakdown.append({'percent': total_percent, 'label': total_label, 'detail': total_detail, 'category': self.category, 'prominent': True}) + if not self.hide_average: + breakdown.append({'percent': total_percent, 'label': total_label, 'detail': total_detail, 'category': self.category, 'prominent': True}) return {'percent': total_percent, 'section_breakdown': breakdown, From 5a65c245071d49edc39faf4b95c441ae38463669 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Wed, 19 Dec 2012 12:37:02 -0500 Subject: [PATCH 2/3] Added parameters to hide grade totals and grade cutoffs in progress graph. --- lms/templates/courseware/progress_graph.js | 59 ++++++++++++---------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/lms/templates/courseware/progress_graph.js b/lms/templates/courseware/progress_graph.js index 189137ada3..449cad766f 100644 --- a/lms/templates/courseware/progress_graph.js +++ b/lms/templates/courseware/progress_graph.js @@ -1,4 +1,4 @@ -<%page args="grade_summary, grade_cutoffs, graph_div_id, **kwargs"/> +<%page args="grade_summary, grade_cutoffs, graph_div_id, show_grade_breakdown = True, show_grade_cutoffs = True, **kwargs"/> <%! import json import math @@ -70,25 +70,26 @@ $(function () { series = categories.values() overviewBarX = tickIndex extraColorIndex = len(categories) #Keeping track of the next color to use for categories not in categories[] - - for section in grade_summary['grade_breakdown']: - if section['percent'] > 0: - if section['category'] in categories: - color = categories[ section['category'] ]['color'] - else: - color = colors[ extraColorIndex % len(colors) ] - extraColorIndex += 1 - - series.append({ - 'label' : section['category'] + "-grade_breakdown", - 'data' : [ [overviewBarX, section['percent']] ], - 'color' : color - }) - - detail_tooltips[section['category'] + "-grade_breakdown"] = [ section['detail'] ] - ticks += [ [overviewBarX, "Total"] ] - tickIndex += 1 + sectionSpacer + if show_grade_breakdown: + for section in grade_summary['grade_breakdown']: + if section['percent'] > 0: + if section['category'] in categories: + color = categories[ section['category'] ]['color'] + else: + color = colors[ extraColorIndex % len(colors) ] + extraColorIndex += 1 + + series.append({ + 'label' : section['category'] + "-grade_breakdown", + 'data' : [ [overviewBarX, section['percent']] ], + 'color' : color + }) + + detail_tooltips[section['category'] + "-grade_breakdown"] = [ section['detail'] ] + + ticks += [ [overviewBarX, "Total"] ] + tickIndex += 1 + sectionSpacer totalScore = grade_summary['percent'] detail_tooltips['Dropped Scores'] = dropped_score_tooltips @@ -97,10 +98,14 @@ $(function () { ## ----------------------------- Grade cutoffs ------------------------- ## grade_cutoff_ticks = [ [1, "100%"], [0, "0%"] ] - descending_grades = sorted(grade_cutoffs, key=lambda x: grade_cutoffs[x], reverse=True) - for grade in descending_grades: - percent = grade_cutoffs[grade] - grade_cutoff_ticks.append( [ percent, "{0} {1:.0%}".format(grade, percent) ] ) + if show_grade_cutoffs: + grade_cutoff_ticks = [ [1, "100%"], [0, "0%"] ] + descending_grades = sorted(grade_cutoffs, key=lambda x: grade_cutoffs[x], reverse=True) + for grade in descending_grades: + percent = grade_cutoffs[grade] + grade_cutoff_ticks.append( [ percent, "{0} {1:.0%}".format(grade, percent) ] ) + else: + grade_cutoff_ticks = [ ] %> var series = ${ json.dumps( series ) }; @@ -135,9 +140,11 @@ $(function () { var $grade_detail_graph = $("#${graph_div_id}"); if ($grade_detail_graph.length > 0) { var plot = $.plot($grade_detail_graph, series, options); - //We need to put back the plotting of the percent here - var o = plot.pointOffset({x: ${overviewBarX} , y: ${totalScore}}); - $grade_detail_graph.append('
${"{totalscore:.0%}".format(totalscore=totalScore)}
'); + + %if show_grade_breakdown: + var o = plot.pointOffset({x: ${overviewBarX} , y: ${totalScore}}); + $grade_detail_graph.append('
${"{totalscore:.0%}".format(totalscore=totalScore)}
'); + %endif } var previousPoint = null; From d911297670d39d74bcb409fbee1fecdd94d5bbf2 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Wed, 19 Dec 2012 12:47:43 -0500 Subject: [PATCH 3/3] The progress page now checks course.metadata.get(no_grade, False) to see if the course has a grade. --- lms/templates/courseware/progress.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/templates/courseware/progress.html b/lms/templates/courseware/progress.html index 81268ff081..fb163d112d 100644 --- a/lms/templates/courseware/progress.html +++ b/lms/templates/courseware/progress.html @@ -18,7 +18,7 @@