Commit 0fc15978 by Bill Filler

add flag to not persist grade in SubsectionGradeFactory

parent f448b63c
......@@ -63,7 +63,7 @@ class SubsectionGradeFactory(object):
)
self._unsaved_subsection_grades.clear()
def update(self, subsection, only_if_higher=None, score_deleted=False):
def update(self, subsection, only_if_higher=None, score_deleted=False, persist_grade=True):
"""
Updates the SubsectionGrade object for the student and subsection.
"""
......@@ -73,7 +73,7 @@ class SubsectionGradeFactory(object):
subsection, self.course_data.structure, self._submissions_scores, self._csm_scores,
)
if should_persist_grades(self.course_data.course_key):
if persist_grade and should_persist_grades(self.course_data.course_key):
if only_if_higher:
try:
grade_model = PersistentSubsectionGrade.read_grade(self.student.id, subsection.location)
......
......@@ -342,11 +342,11 @@ def compute_is_prereq_met(content_id, user_id, recalc_on_unmet=False):
with store.bulk_operations(course_id):
subsection_usage_key = UsageKey.from_string(_get_gating_block_id(milestone))
subsection_structure = get_course_blocks(student, subsection_usage_key)
subsection_grade_factory = SubsectionGradeFactory(student, None, subsection_structure)
subsection_grade_factory = SubsectionGradeFactory(student, course_structure=subsection_structure)
if subsection_usage_key in subsection_structure:
# this will force a recalcuation of the subsection grade
subsection_grade = subsection_grade_factory.update(subsection_structure[subsection_usage_key])
subsection_grade = subsection_grade_factory.update(subsection_structure[subsection_usage_key], persist_grade=False)
prereq_met = update_milestone(milestone, subsection_grade, milestone, user_id)
prereq_meta_info = {
'url': reverse('jump_to', kwargs={'course_id': course_id, 'location': subsection_usage_key}),
......
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