Skip to content
Snippets Groups Projects
Commit 801acb68 authored by Sofia Yoon's avatar Sofia Yoon
Browse files

fix: only apply due date to subsection if there is non-ora content

parent 67da5bbb
Branches
Tags
No related merge requests found
......@@ -91,13 +91,30 @@ def _get_custom_pacing_children(subsection, num_weeks):
Return relative date items for the subsection and its children
"""
items = [subsection]
has_content = False
all_problems_are_ora = True
section_date_items = []
while items:
next_item = items.pop()
is_problem = next_item.category not in {'sequential', 'vertical'}
if is_problem:
has_content = True
# Open response assessment problems have their own due dates
if next_item.category != 'openassessment':
section_date_items.append((next_item.location, {'due': timedelta(weeks=num_weeks)}))
items.extend(next_item.get_children())
if is_problem:
all_problems_are_ora = False
# If all the problems are ORA then we return an empty list. This is to avoid potential conflicts with
# custom relative dates through PLS and Studio since ORA problems have their own due dates.
if has_content and all_problems_are_ora:
return []
# If there are non ORA content problems or if there are no problems at all return the list of date items.
# Relative dates should apply to subsections and their children if there are other graded assignments
# in it (i.e. non-ORA problems). The current custom PLS allows for due dates to be set even for empty
# units.
return section_date_items
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment