This is the final step in removing the deprecated flag_undefined_default as explained by the following ADR: https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/waffle_utils/docs/decisions/0001-refactor-waffle-flag-default.rst Notes: * All uses of flag_undefined_default=False were always supposed to have been no-ops. * All uses of flag_undefined_default=True that are removed in this PR have been replaced by migrations in past PRs. * The temporary metric temp_flag_default_used id no longer reporting any data. ARCHBOM-1305
74 lines
2.5 KiB
Python
74 lines
2.5 KiB
Python
"""
|
|
This module contains various configuration settings via
|
|
waffle switches for the Grades app.
|
|
"""
|
|
|
|
|
|
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace, WaffleSwitchNamespace
|
|
|
|
# Namespace
|
|
WAFFLE_NAMESPACE = u'grades'
|
|
|
|
# Switches
|
|
ASSUME_ZERO_GRADE_IF_ABSENT = u'assume_zero_grade_if_absent'
|
|
DISABLE_REGRADE_ON_POLICY_CHANGE = u'disable_regrade_on_policy_change'
|
|
|
|
# Course Flags
|
|
REJECTED_EXAM_OVERRIDES_GRADE = u'rejected_exam_overrides_grade'
|
|
ENFORCE_FREEZE_GRADE_AFTER_COURSE_END = u'enforce_freeze_grade_after_course_end'
|
|
WRITABLE_GRADEBOOK = u'writable_gradebook'
|
|
BULK_MANAGEMENT = u'bulk_management'
|
|
|
|
|
|
def waffle():
|
|
"""
|
|
Returns the namespaced, cached, audited Waffle class for Grades.
|
|
"""
|
|
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Grades: ')
|
|
|
|
|
|
def waffle_flags():
|
|
"""
|
|
Returns the namespaced, cached, audited Waffle flags dictionary for Grades.
|
|
"""
|
|
namespace = WaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Grades: ')
|
|
return {
|
|
# By default, enable rejected exam grade overrides. Can be disabled on a course-by-course basis.
|
|
# TODO: After removing this flag, add a migration to remove waffle flag in a follow-up deployment.
|
|
REJECTED_EXAM_OVERRIDES_GRADE: CourseWaffleFlag(
|
|
namespace,
|
|
REJECTED_EXAM_OVERRIDES_GRADE,
|
|
),
|
|
# TODO: After removing this flag, add a migration to remove waffle flag in a follow-up deployment.
|
|
ENFORCE_FREEZE_GRADE_AFTER_COURSE_END: CourseWaffleFlag(
|
|
namespace,
|
|
ENFORCE_FREEZE_GRADE_AFTER_COURSE_END,
|
|
),
|
|
# Have this course override flag so we can selectively turn off the gradebook for courses.
|
|
# TODO: After removing this flag, add a migration to remove waffle flag in a follow-up deployment.
|
|
WRITABLE_GRADEBOOK: CourseWaffleFlag(
|
|
namespace,
|
|
WRITABLE_GRADEBOOK,
|
|
),
|
|
BULK_MANAGEMENT: CourseWaffleFlag(
|
|
namespace,
|
|
BULK_MANAGEMENT,
|
|
),
|
|
}
|
|
|
|
|
|
def is_writable_gradebook_enabled(course_key):
|
|
"""
|
|
Returns whether the writable gradebook app is enabled for the given course.
|
|
"""
|
|
return waffle_flags()[WRITABLE_GRADEBOOK].is_enabled(course_key)
|
|
|
|
|
|
def gradebook_can_see_bulk_management(course_key):
|
|
"""
|
|
Returns whether bulk management features should be visible for the given course.
|
|
|
|
(provided that course contains a masters track, as of this writing)
|
|
"""
|
|
return waffle_flags()[BULK_MANAGEMENT].is_enabled(course_key)
|