-
Notifications
You must be signed in to change notification settings - Fork 17
Subsections in Learning Core #301
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
Subsections in Learning Core #301
Conversation
|
Thanks for the pull request, @andrii-hantkovskyi! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
Hi @kdmccormick and @ormsbee, could you please review this PR when you have a chance? |
| entity_list = getattr(container.versioning.draft, "entity_list", None) | ||
| # ?FOR REVIEW: Is this correct? | ||
| if entity_list is None: | ||
| # This container has not been published yet, or has been deleted. | ||
| return False |
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.
container.versioning.draft should always return an object with an entity_list. Are you finding that the attribute is missing sometimes?
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.
Yeah, test_soft_deleting_unit is failing when calling authoring_api.contains_unpublished_changes because of:
entity_list = container.versioning.draft.entity_list
E AttributeError: 'NoneType' object has no attribute 'entity_list'
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.
I think this will happen if you create a publishable entity but haven't created any versions of that entity. It's probably worth just bootstrapping it so that creating a PublishableEntity always sets the Draft and Published versions to None, so we never have to deal with that state.
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.
I dug down a bit and found it's not an issue with creating but soft-deleting. When we call the soft_delete_draft method, it sets the draft version of PublishableEntity to None, which is why we're getting that error.
For now, I left a comment inside if, which says that the container was soft-deleted. If this needs any other changes, please let me know
| @@ -0,0 +1,50 @@ | |||
| """ | |||
| Models that implement units | |||
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.
| Models that implement units | |
| Models that implement subsections |
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.
fixed
| publishable_entities_pks=publishable_entities_pks, | ||
| entity_version_pks=entity_version_pks, |
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.
This API contract has changed as of a recent PR. Please update to the latest.
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.
updated
| entity_list = getattr(container.versioning.draft, "entity_list", None) | ||
| # ?FOR REVIEW: Is this correct? | ||
| if entity_list is None: | ||
| # This container has not been published yet, or has been deleted. | ||
| return False |
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.
I think this will happen if you create a publishable entity but haven't created any versions of that entity. It's probably worth just bootstrapping it so that creating a PublishableEntity always sets the Draft and Published versions to None, so we never have to deal with that state.
7f5d5fd to
3010e9d
Compare
|
@andrii-hantkovskyi : as a general rule, please don't force push changes on PRs under active review unless you have to. It just makes it harder to filter out what's changed since the last commit. |
|
@andrii-hantkovskyi: Please submit your signed contributor agreement, per the instructions below:
You can tag me on the ticket. We need this before we can merge any code written by you. Thank you. |
|
Also, please fix the various linter errors on this PR. Thank you. |
8f2fcdf to
498e5cd
Compare
Co-authored-by: Kyle McCormick <[email protected]>
2ff78eb to
7b5cf6e
Compare
This is modeled on the existing apps for units and subsections.
- Created new sections models and API as part of the sections app
- Implemented container behavior where publishing a section automatically
publishes its child subsections
- Added comprehensive functionality to manage the section lifecycle:
- Creation of sections and section versions
- Ability to pin specific subsection versions or use the latest
versions
- Retrieval of subsections contained within sections (both draft
and published)
- Added high-level APIs for section management:
- get_subsections_in_section to retrieve subsections in draft or
published sections
- get_subsections_in_published_section_as_of to access historical
states of sections
- Various utility functions for section creation and version
management
- Bumped openedx_learning to 0.25.0 to account for changes from
Subsections in Learning Core #301, which were merged without a
version update.
---------
Co-authored-by: Andrii <[email protected]>
This PR implements the new subsections functionality in Learning Core, which allows for organizing units within hierarchical containers. Subsections serve as containers that can store and manage units within the content structure.
Changes in this PR
get_units_in_subsectionto retrieve units in draft or published subsectionsget_units_in_published_subsection_as_ofto access historical states of subsectionsThis implementation extends our hierarchical content structure, allowing for more organized content arrangement with units being contained within subsections.