Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lms/djangoapps/courseware/courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,8 @@ def get_course_assignments(course_key, user, include_access=False):
'start': block_data.get_xblock_field(descendent, 'submission_start'),
'required': True
}]
valid_assessments = block_data.get_xblock_field(descendent, 'valid_assessments')
print(valid_assessments)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the 👏


valid_assessments = block_data.get_xblock_field(descendent, 'valid_assessments')
if valid_assessments:
all_assessments.extend(valid_assessments)

Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def name(cls):
Unique identifier for the transformer's class;
same identifier used in setup.py.
"""
return "content_type_gate"
return 'open_assessment_transformer'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy pasta error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume so


@classmethod
def collect(cls, block_structure):
Expand Down
48 changes: 29 additions & 19 deletions openedx/core/djangoapps/course_date_signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ def _field_values(fields, xblock):
return result


def _gather_graded_items(root, due):
items = [root]
has_non_ora_scored_content = False
collected_items = []
while items:
next_item = items.pop()
if next_item.graded:
# TODO: Once studio can manually set relative dates, we would need to manually check for them here
collected_items.append((next_item.location, {'due': due}))
# TODO: This is pretty gross, and should maybe be configurable in the future,
# especially if we find ourselves needing more exceptions.
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:
return collected_items
return []


def extract_dates_from_course(course):
"""
Extract all dates from the supplied course.
Expand All @@ -53,26 +76,13 @@ def extract_dates_from_course(course):
# Apply the same relative due date to all content inside a section,
# 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
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)
for subsection in section.get_children():
section_date_items.extend(_gather_graded_items(subsection, weeks_to_complete))

if section_date_items and section.graded:
date_items.append((section.location, weeks_to_complete))
date_items.extend(section_date_items)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have this outside the if statement? Either the section_date_items are [] and there is nothing to add. Or they are not [], but if the section isn't graded, this would still add the subsection dates and I'm not sure we want that. Just pondering out loud here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought it looked cleaner this way. But I can be convinced it is too implicit or is confusing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern would be for the case where section_date_items != [] and section.graded = False and we add subsection dates without adding in the section due date. I'm not sure this scenario can even happen, but might be good to be defensive about it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that can happen (I believe graded is bubbled up the tree). But also, that is the behavior of the existing code. So it wouldn't be a regression at least.

else:
date_items = []
store = modulestore()
Expand Down