def test_update_or_create_attempted(self, is_active, expected_first_attempted): with freeze_time(now()): if expected_first_attempted is None: expected_first_attempted = now() with waffle.waffle().override(waffle.ESTIMATE_FIRST_ATTEMPTED, active=is_active): grade = PersistentSubsectionGrade.update_or_create_grade(**self.params) self.assertEqual(grade.first_attempted, expected_first_attempted)
def assume_zero_if_absent(course_key): """ Returns whether an absent grade should be assumed to be zero. """ return should_persist_grades(course_key) and waffle().is_enabled( ASSUME_ZERO_GRADE_IF_ABSENT)