Ticket: 

Notes

Here are the places where grades get updated:

PersistentCourseGrade.update_or_create
	CourseGradeFactory._update
		CourseGradeFactory().update
			1. CourseGradeFactory().iter if force_update
				compute_grades_for_course (** TASK)
					* management command: compute_grades
					* compute_all_grades_for_course
						GRADING_POLICY_CHANGED (handle_grading_policy_changed)

			2. SUBSECTION_SCORE_CHANGED (recalculate_course_grade_only)
				recalculate_subsection_grade_v3 (** TASK **)
					PROBLEM_WEIGHTED_SCORE_CHANGED (enqueue_subsection_update)
					SUBSECTION_OVERRIDE_CHANGED (enqueue_subsection_update)
					management command: recalculate_subsection_grades

			3. recalculate_course_and_subsection_grades_for_user (** TASK **)
				ENROLLMENT_TRACK_UPDATED (recalculate_course_and_subsection_grades)
				COHORT_MEMBERSHIP_UPDATED (recalculate_course_and_subsection_grades)
				management command: recalculate_learner_grades

GradesService.override_subsection_grade
GradesService.undo_override_subsection_grade
	SUBSECTION_OVERRIDE_CHANGED (enqueue_subsection_update) 

Questions

  1. Are we Ok with the CoursewareStudentModule and Submissions tables being updated, but not the grades?
  2. Are we Ok with the Subsection Grades getting updated, but not the Course grades?
  3. Are we Ok with the Course Grading policy getting updated, but not the grades?
  4. Are we Ok for self-paced course grades being update if it sets a course_end_date
  5. What is GRADING_POLICY_COUNTDOWN_SECONDS lock?
  6. What happens when someone changes the end date of the course to be a later date?
  7. Where to place the helper method? There is signal handler in CMS for course grade update and there are signal handlers in LMS for subsection grade changes when learner attempts to score a problem.

 Thoughts

Decisions

MVP

Technical Details

Helper method

from datetime import timedelta
from django.utils import timezone
def should_update_grades(course_key):
    some_waffle_switch = True // Some waffle switch which we can pull information from for active/inactive?
    course = CourseOverview.get_from_id(course_key)
    if some_waffle_switch and course.end: // Not sure if we are ok for self paced courses with ends dates to be the part of the change 
    grade_update_offset = course.end + timedelta(30) // There should some good place to store `30`. A config model/settings/static variable? 
    now = timezone.now()
    if now > offset:
        return False
 return True