Commit eddf5ad7 by Sofiya Semenova

?

parent f8841f18
...@@ -19,13 +19,19 @@ class CourseGradeBase(object): ...@@ -19,13 +19,19 @@ class CourseGradeBase(object):
""" """
Base class for Course Grades. Base class for Course Grades.
""" """
def __init__(self, user, course_data, percent=0.0, letter_grade=None, passed=False, force_update_subsections=False): def __init__(self, user, course_data,
percent=0.0, letter_grade=None,
passed=False, force_update_subsections=False,
enrollment_track_changed=False
):
self.user = user self.user = user
self.course_data = course_data self.course_data = course_data
self.percent = percent self.percent = percent
self.passed = passed self.passed = passed
self.enrollment_track_changed = enrollment_track_changed
# Convert empty strings to None when reading from the table # Convert empty strings to None when reading from the table
self.letter_grade = letter_grade or None self.letter_grade = letter_grade or None
self.force_update_subsections = force_update_subsections self.force_update_subsections = force_update_subsections
...@@ -213,7 +219,7 @@ class CourseGradeBase(object): ...@@ -213,7 +219,7 @@ class CourseGradeBase(object):
""" """
Returns a list of subsection grades for the given chapter. Returns a list of subsection grades for the given chapter.
""" """
enrollment_track_changed = False if self.enrollment_track_changed is None else self.enrollment_track_changed enrollment_track_changed = bool(self.enrollment_track_changed)
return [ return [
self._get_subsection_grade(course_structure[subsection_key], enrollment_track_changed) self._get_subsection_grade(course_structure[subsection_key], enrollment_track_changed)
for subsection_key in _uniqueify_and_keep_order(course_structure.get_children(chapter_key)) for subsection_key in _uniqueify_and_keep_order(course_structure.get_children(chapter_key))
......
...@@ -92,7 +92,8 @@ class SubsectionGradeFactory(object): ...@@ -92,7 +92,8 @@ class SubsectionGradeFactory(object):
grade_model = calculated_grade.update_or_create_model( grade_model = calculated_grade.update_or_create_model(
self.student, self.student,
score_deleted, score_deleted,
enrollment_track_changed) enrollment_track_changed
)
self._update_saved_subsection_grade(subsection.location, grade_model) self._update_saved_subsection_grade(subsection.location, grade_model)
return calculated_grade return calculated_grade
......
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