This is a first stage for removing the LegacyWaffle* classes. LegacyWaffleFlag usage replaced with WaffleFlag; LegacyWaffleSwitche usage replaced with WaffleSwitch; New CourseWaffleFlag added to the temporary module __future__ as FutureCourseWaffleFlag; Updated all the imports to use CourseWaffleFlag from the __future__ module; BREAKING CHANGE: A number of toggle related constants (e.g. ENABLE_ACCESSIBILITY_POLICY_PAGE) changed types. They were strings, and are now toggle instances (e.g. WaffleSwitch). Although the entire refactor should be self-contained in edx-platform, if any plugins or dependencies were directly using these constants, they will break. If this is the case, try to find a better publicized way of exposing those toggles.
29 lines
734 B
Python
29 lines
734 B
Python
"""
|
|
Defines grading configuration.
|
|
"""
|
|
|
|
|
|
from django.conf import settings
|
|
|
|
from lms.djangoapps.grades.config.models import PersistentGradesEnabledFlag
|
|
from lms.djangoapps.grades.config.waffle import 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 (
|
|
settings.FEATURES.get('ASSUME_ZERO_GRADE_IF_ABSENT_FOR_ALL_TESTS') or
|
|
ASSUME_ZERO_GRADE_IF_ABSENT.is_enabled()
|
|
)
|
|
)
|
|
|
|
|
|
def should_persist_grades(course_key):
|
|
"""
|
|
Returns whether grades should be persisted.
|
|
"""
|
|
return PersistentGradesEnabledFlag.feature_enabled(course_key)
|