Repository navigation
feat: copy content tags and competency criteria on course rerun - #39372
alezconsultant wants to merge 1 commit into
Conversation
rerun_course now calls copy_course_tags_and_criteria() before it marks the rerun as succeeded. The function copies the source run's content tags to the new run as editable tags and then copies its competency criteria, in one transaction. A failure reaches the existing rerun failure handling, which marks the rerun as failed and deletes the cloned course. A taxonomy that is not enabled for the new run's organization is left out, together with its criteria, and a warning is logged. The catalog CourseRun row for the new run is created when it is missing, because criteria groups reference it and the publish handler may not have created it. Related to openedx/openedx-core#694 Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Thanks for the pull request, @alezconsultant! 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. DetailsWhere 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. |
|
@coderabbitai full review |
jesperhodge
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I found a possible issue with a side effect that creates a catalog course run. I don't see any of that in the acceptance criteria. Is it possible that the course and course run vocabulary made the acceptance criteria confusing?
The idea here if I understand it correctly is: when a course author creates a new course run for an existing course - the new course run is simply a copy of an existing course - , then the new course's objects get tagged correctly. This is not about publishing a course run to the catalog.
| Copy the source course run's tags, as editable tags, and its competency criteria onto the destination run. | ||
|
|
||
| Taxonomies not enabled for the destination org are skipped, along with their criteria. | ||
| It also creates the destination run's catalog CourseRun when the source run has one and the destination does not. |
There was a problem hiding this comment.
Why would we want to create a catalog CourseRun here?
There was a problem hiding this comment.
It sounds like a quite serious side effect in a function that's only there to add tags during the copy process and not responsible to create or publish courses.
| return skipped_taxonomy_ids | ||
|
|
||
|
|
||
| def _map_object_id_into_course( |
There was a problem hiding this comment.
Maybe _map_object_id_from_one_course_to_another?
Description
Adds the
openedx-platformhalf of openedx/openedx-core#694: a new run of a course gets its own copy of the source run's content tags and competency criteria.rerun_coursecalls the newcontent_tagging.api.copy_course_tags_and_criteria(source_course_key, destination_course_key)after it sets the initial permissions and before it marks the rerun as succeeded. The author therefore sees the new run only after the copy has finished. If the copy raises, the existing failure handling inrerun_coursemarks the rerun as failed and deletes the cloned course, so the author can retry with the same run.Behavior
tag_object, so they are editable on the new run and the source run's tags are unchanged.copy_competency_criteria_for_course_rerunfromopenedx-core.CourseRunrow for the new run is created if it is missing, because criteria groups reference that row. The course publish handler creates the row when it has run, so this creation covers a rerun in which it has not. The row gets the cloned course's display name, cut to the 255 characters the title column holds, and the course's language when it is one ofALL_LANGUAGES. In a test with the course-published signal enabled the row already existed when the copy ran; a live rerun was not observed.Dependencies
This needs an
openedx-corerelease that containscopy_competency_criteria_for_course_rerun. The requirements bump is added to this PR once that release exists.Testing
pytest openedx/core/djangoapps/content_tagging/tests/test_api.py -k CopyCourseTagsAndCriteriaandpytest cms/djangoapps/contentstore/tests/test_tasks.py -k RerunCourseTaskTestCase.Manual testing
Known limits
CourseRunrow, and the copied criteria groups and criteria are deleted with that row. The copied tags remain, as they do after any course deletion. A retry with the same run creates theCourseRunrow and the criteria again and applies the same tags, so it ends with one copy.tag_objectsends its tag-changed events inside the transaction, so a copy that rolls back has already sent events for the new run's blocks. The cloned course is deleted in that case.Tagrow, and the copy reads tags withget_all_object_tags, which returns only tags that have one. Copy and paste, duplicate, and export already behave the same way.Related to openedx/openedx-core#694
🤖 Generated with Claude Code