-
Notifications
You must be signed in to change notification settings - Fork 4.3k
AA-335: Avoid due dates for ORA subsections #24987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copy pasta error?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume so |
||
|
|
||
| @classmethod | ||
| def collect(cls, block_structure): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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. | ||
|
|
@@ -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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My only concern would be for the case where
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that can happen (I believe |
||
| else: | ||
| date_items = [] | ||
| store = modulestore() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the 👏