diff --git a/lms/djangoapps/grades/models.py b/lms/djangoapps/grades/models.py index b803856bfb..3b22c414f2 100644 --- a/lms/djangoapps/grades/models.py +++ b/lms/djangoapps/grades/models.py @@ -654,6 +654,9 @@ class PersistentSubsectionGradeOverride(models.Model): u"possible_graded_override: {}".format(self.possible_graded_override), ]) + def get_history(self): + return PersistentSubsectionGradeOverrideHistory.get_override_history(self.id) + @classmethod def prefetch(cls, user_id, course_key): get_cache(cls._CACHE_NAMESPACE)[(user_id, str(course_key))] = { @@ -777,6 +780,10 @@ class PersistentSubsectionGradeOverrideHistory(models.Model): self.created ) + @classmethod + def get_override_history(cls, override_id): + return cls.objects.filter(override_id=override_id) + def prefetch(user, course_key): PersistentSubsectionGradeOverride.prefetch(user.id, course_key) diff --git a/lms/templates/courseware/progress.html b/lms/templates/courseware/progress.html index 03598104c0..fc06cf75a2 100644 --- a/lms/templates/courseware/progress.html +++ b/lms/templates/courseware/progress.html @@ -5,6 +5,7 @@ <%! from course_modes.models import CourseMode from lms.djangoapps.certificates.models import CertificateStatuses +from lms.djangoapps.grades.models import PersistentSubsectionGradeOverrideHistory from django.utils.translation import ugettext as _ from openedx.core.djangolib.markup import HTML, Text from django.urls import reverse @@ -168,10 +169,10 @@ username = get_enterprise_learner_generic_name(request) or student.username %for section in chapter['sections']:
<% - earned = section.all_total.earned - total = section.all_total.possible + earned = section.graded_total.earned + total = section.graded_total.possible - percentageString = "{0:.0%}".format(section.percent_graded) if earned > 0 and total > 0 else "" + percentageString = "{0:.0%}".format(section.percent_graded) if total > 0 or earned > 0 else "" %>

@@ -196,7 +197,8 @@ username = get_enterprise_learner_generic_name(request) or student.username

%if section.override is not None: - %if section.format is not None and section.format == "Exam": + <%last_override_history = section.override.get_history().order_by('created').last()%> + %if (not last_override_history or last_override_history.feature == PersistentSubsectionGradeOverrideHistory.PROCTORING) and section.format == "Exam" and earned == 0: ${_("Suspicious activity detected during proctored exam review. Exam score 0.")} %else: ${_("Section grade has been overridden.")}