Files
edx-platform/lms/djangoapps/grades/grade_utils.py
Eugene Dyudyunov 8bd43207ca refactor!: switch from LegacyWaffle* to modern waffles (#30330)
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.
2022-05-05 12:03:10 -04:00

29 lines
741 B
Python

"""
This module contains utility functions for grading.
"""
import logging
from datetime import timedelta
from django.utils import timezone
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from .config.waffle import ENFORCE_FREEZE_GRADE_AFTER_COURSE_END
log = logging.getLogger(__name__)
def are_grades_frozen(course_key):
"""
Returns whether grades are frozen for the given course.
"""
if ENFORCE_FREEZE_GRADE_AFTER_COURSE_END.is_enabled(course_key):
course = CourseOverview.get_from_id(course_key)
if course.end:
freeze_grade_date = course.end + timedelta(30)
now = timezone.now()
return now > freeze_grade_date
return False