Add ShowCorrectness to progress graph

Hi. I’ve been a long-time student on, and throughout numerous courses over years’ span, including some with MITx’s Micromasters, there has been one bug that involved disabling the progress bars to avoid giving away exam answers. So I decided to see if anything could be done about it. The issue is that it seems reasonable that when section.show_correctness == 'past_due', the progress graph should also disable the bars for just that section.

However, while an object containing all the subsection grade objects (courseware_summary) is passed through the context to render the progress page, only the grade_summary is passed to progress_graph.js. This latter object is created from the summary property of CourseGrade, which calls grade() from xmodule/ to set up all the bars. Interestingly, these parts (the property and the xmodules) are marked deprecated in the code.

I wonder if it’s possible to add this functionality, whether by adding show_correctness to the summary in CourseGrade or the templates, and whether you guys think this is a good idea. I wouldn’t mind taking a shot at it if the feature desirable.

Here’s an example of what I’d be proposing:

def graded_subsections_by_format(self):
    Returns grades for the subsections in the course in
    a dict keyed by subsection format types.
    subsections_by_format = defaultdict(OrderedDict)
    for chapter in six.itervalues(self.chapter_grades):
        for subsection_grade in chapter['sections']:
            if subsection_grade.graded:
                graded_total = subsection_grade.graded_total
                if graded_total.possible > 0:
                    # THESE LINES ARE ADDED
                    # ======================
                    if not subsection_grade.show_grades(self.user.is_staff):
                        subsection_grade.graded_total.earned = 0
                    # ======================
                    subsections_by_format[subsection_grade.format][subsection_grade.location] = subsection_grade
    return subsections_by_format