From 28ce713e9fb4cb40b9981a7590a5b7bb4c1a2314 Mon Sep 17 00:00:00 2001 From: Muhammad Anas <88967643+Anas12091101@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:23:50 +0500 Subject: [PATCH] feat: added custom setting attribute for gradebook freeze timedelta (#35189) * feat: added custom setting attribute for gradebook freeze timedelta --- lms/djangoapps/grades/grade_utils.py | 3 ++- lms/envs/common.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/grades/grade_utils.py b/lms/djangoapps/grades/grade_utils.py index 0344cf6c20d1..05d2058f37ba 100644 --- a/lms/djangoapps/grades/grade_utils.py +++ b/lms/djangoapps/grades/grade_utils.py @@ -7,6 +7,7 @@ from datetime import timedelta from django.utils import timezone +from django.conf import settings from openedx.core.djangoapps.content.course_overviews.models import CourseOverview @@ -22,7 +23,7 @@ def are_grades_frozen(course_key): 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) + freeze_grade_date = course.end + timedelta(settings.GRADEBOOK_FREEZE_DAYS) now = timezone.now() return now > freeze_grade_date return False diff --git a/lms/envs/common.py b/lms/envs/common.py index 9f9004976e0c..d0d2eeae765c 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1101,6 +1101,11 @@ # If this is true, random scores will be generated for the purpose of debugging the profile graphs GENERATE_PROFILE_SCORES = False +# .. setting_name: GRADEBOOK_FREEZE_DAYS +# .. setting_default: 30 +# .. setting_description: Sets the number of days after which the gradebook will freeze following the course's end. +GRADEBOOK_FREEZE_DAYS = 30 + # Used with XQueue XQUEUE_WAITTIME_BETWEEN_REQUESTS = 5 # seconds XQUEUE_INTERFACE = {