feat: warn when relative dates are past due and can't be shifted

This commit is contained in:
Daniel Valenzuela
2024-03-13 21:33:03 -03:00
committed by Piotr Surowiec
parent a3bafb2ccd
commit b98cbd4c2c
4 changed files with 30 additions and 14 deletions

View File

@@ -141,13 +141,19 @@ def get_start_block(block):
return get_start_block(first_child)
def dates_banner_should_display(course_key, user):
def dates_banner_should_display(course_key, user, allow_warning=False):
"""
Return whether or not the reset banner should display,
determined by whether or not a course has any past-due,
incomplete sequentials and which enrollment mode is being
dealt with for the current user and course.
Args:
course_key (CourseKey)
user (User)
allow_warning (bool): whether to ignore relative_dates_disable_reset_flag, in order to render
warnings for past-due incomplete units.
Returns:
(missed_deadlines, missed_gated_content):
missed_deadlines is True if the user has missed any graded content deadlines
@@ -156,7 +162,7 @@ def dates_banner_should_display(course_key, user):
if not RELATIVE_DATES_FLAG.is_enabled(course_key):
return False, False
if RELATIVE_DATES_DISABLE_RESET_FLAG.is_enabled(course_key):
if RELATIVE_DATES_DISABLE_RESET_FLAG.is_enabled(course_key) and not allow_warning:
# The `missed_deadlines` value is ignored by `reset_course_deadlines` views. Instead, they check the value of
# `missed_gated_content` to determine if learners can reset the deadlines by themselves.
# We could have added this logic directly to `reset_self_paced_schedule`, but this function is used in other