From d90a139259acd4ca2312107d0c6dc23087df7a51 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 19 May 2020 15:47:04 -0400 Subject: [PATCH] Only add PLS dates to graded sections that have scored, non-ORA content. --- .../djangoapps/course_date_signals/handlers.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/course_date_signals/handlers.py b/openedx/core/djangoapps/course_date_signals/handlers.py index f846e6e775..69c6951121 100644 --- a/openedx/core/djangoapps/course_date_signals/handlers.py +++ b/openedx/core/djangoapps/course_date_signals/handlers.py @@ -53,13 +53,25 @@ def extract_dates_from_course(course): # unless that item already has a relative date set for _, section, weeks_to_complete in spaced_out_sections(course): items = [section] + has_non_ora_scored_content = False + section_date_items = [] while items: next_item = items.pop() + # TODO: This is pretty gross, and should maybe be configurable in the future, + # especially if we find ourselves needing more exceptions. if next_item.graded: # TODO: Once studio can manually set relative dates, # we would need to manually check for them here - date_items.append((next_item.location, {'due': weeks_to_complete})) + section_date_items.append((next_item.location, {'due': weeks_to_complete})) + has_non_ora_scored_content = ( + has_non_ora_scored_content or + (next_item.has_score and next_item.category != 'openassessment') + ) + items.extend(next_item.get_children()) + + if has_non_ora_scored_content: + date_items.extend(section_date_items) else: date_items = [] store = modulestore()