Add a new waffle switch that allows us to assume zero grades for learners who have no entry previously recorded, and another to disable persisting grades for unengaged learners. TNL-6691
17 lines
553 B
Python
17 lines
553 B
Python
from lms.djangoapps.grades.config.models import PersistentGradesEnabledFlag
|
|
from lms.djangoapps.grades.config.waffle import waffle, ASSUME_ZERO_GRADE_IF_ABSENT
|
|
|
|
|
|
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)
|
|
|
|
|
|
def should_persist_grades(course_key):
|
|
"""
|
|
Returns whether grades should be persisted.
|
|
"""
|
|
return PersistentGradesEnabledFlag.feature_enabled(course_key)
|