feat: [FC-7879] add signal handler to save assignment dates to Conten…#347
feat: [FC-7879] add signal handler to save assignment dates to Conten…#347kyrylo-kh wants to merge 2 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @kyrylo-kh! 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. |
|
@kyrylo-kh the branch is reporting as out of date, but I don't have the ability to pull in the latest from base. Can you do so an push it up. |
|
@kyrylo-kh sorry, there also seem to be a bunch of failing tests. Perhaps a rebase will also fix this, but please have a look. |
edx_when/api.py
Outdated
| block_type=assignment.assignment_type, | ||
| defaults={ | ||
| 'policy': models.DatePolicy.objects.get_or_create(abs_date=assignment.date)[0], | ||
| 'assignment_title': assignment.title, |
There was a problem hiding this comment.
This section is a little strange to me. assignment.title is used twice and is unlikely to be the reliably the subsection_name.
There was a problem hiding this comment.
Do you mean it can confuse having subsection_name in model for different type of content?
We wrote description of this in argument:
assignments: List of Assignment instances. Assignments with missing date or
title are skipped (with a warning). Use Assignment.subsection_name for
the containing subsection when available; it is stored separately from
assignment_title.
edx_when/api.py
Outdated
| course_key_str | ||
| ) | ||
| continue | ||
| models.ContentDate.objects.update_or_create( |
There was a problem hiding this comment.
There's no transactional boundary set here.
There was a problem hiding this comment.
900b00c to
7c7451a
Compare
7c7451a to
906ef14
Compare
bd16f7c to
f1229a9
Compare
f1229a9 to
9e50d46
Compare
Description
Adds a new signal handler to support saving assignment due dates to the
ContentDatemodel in theedx-whenservice.Key Changes:
Introduces the
_Assignmentdata class to standardize assignment metadata (title, date, block key, type).Implements
update_or_create_assignments_due_dates()to:ContentDateentries with assignment titles, dates, and metadata.block_type,subsection_name, andcourse_name.DatePolicyentries are reused or created as needed.Adds logging and input validation to handle incomplete or invalid assignment data gracefully.
Testing:
Includes a full test suite verifying:
New entries are inserted correctly.
Existing entries are updated when data changes.
Graceful handling of:
DatePolicycreation.