Skip to content

Fix community library submission date updates - #6451

Open
ArpitaSamanta10 wants to merge 1 commit into
learningequality:hotfixesfrom
ArpitaSamanta10:fix/community-library-date-updated
Open

ArpitaSamanta10 wants to merge 1 commit into
learningequality:hotfixesfrom
ArpitaSamanta10:fix/community-library-date-updated

Conversation

@ArpitaSamanta10

@ArpitaSamanta10 ArpitaSamanta10 commented Nov 18, 2026 •

Copy link
Copy Markdown

Summary

Fixed an issue where the date_updated field was not refreshed when community library submissions changed status through queryset updates.

The auto_now=True option on the model field does not automatically update timestamps when using Django's QuerySet.update() method. As a result, submissions transitioning from PENDING to SUPERSEDED or from LIVE to APPROVED retained their previous update timestamps.

This change explicitly sets date_updated=timezone.now() in both queryset updates to ensure the timestamp accurately reflects the status change.

Regression tests have also been added to verify the timestamp updates and ensure submissions belonging to other channels remain unaffected.

References

Reviewer guidance

The following verification has been performed:

  • Added a regression test for updating the previous LIVE submission's date_updated when another submission becomes LIVE.
  • Added a regression test for updating the previous PENDING submission's date_updated when it becomes SUPERSEDED.
  • Verified that submissions belonging to other channels retain their original timestamps.
  • Confirmed that the regression tests fail when the production fix is temporarily removed and pass when the fix is restored.

Tests executed:

  • CommunityLibrarySubmissionTestCase: 18 passed
  • AdminViewSetTestCase: 20 passed
  • test_community_library_submission.py: 60 passed
  • Pre-commit checks on all four modified files: passed

No UI changes or database migrations are involved.

AI usage

I used Claude Code to analyze the existing implementation, identify the queryset updates that bypass Django's auto_now behavior, and implement the corresponding fixes and regression tests.

I reviewed the generated changes and test results, checked that the implementation followed the existing project patterns, and verified the regression tests by temporarily removing the production fix to confirm that they failed as expected. The fix was then restored, and the tests and pre-commit checks passed.

The final changes were limited to the two timestamp updates and their corresponding regression tests.

[x] Contribution is aligned with our contributing guidelines

[x]Pull request description has correctly filled AI usage section & follows our AI guidance:

@ArpitaSamanta10
ArpitaSamanta10 requested review from a team and leq-bot and a balanced review from Copilot November 18, 2026 09:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@learning-equality-bot

Copy link
Copy Markdown
Contributor

👋 Hi @ArpitaSamanta10, thanks for contributing!

For the review process to begin, please verify that the following is satisfied:

  • Contribution is aligned with our contributing guidelines

  • Pull request description has correctly filled AI usage section & follows our AI guidance:

    AI guidance

    State explicitly whether you didn't use or used AI & how.

    If you used it, ensure that the PR is aligned with Using AI as well as our DEEP framework. DEEP asks you:

    • Disclose — Be open about when you've used AI for support.
    • Engage critically — Question what is generated. Review code for correctness and unnecessary complexity.
    • Edit — Review and refine AI output. Remove unnecessary code and verify it still works after your edits.
    • Process sharing — Explain how you used the AI so others can learn.

    Examples of good disclosures:

    "I used Claude Code to implement the component, prompting it to follow the pattern in ComponentX. I reviewed the generated code, removed unnecessary error handling, and verified the tests pass."

    "I brainstormed the approach with Gemini, then had it write failing tests for the feature. After reviewing the tests, I used Claude Code to generate the implementation. I refactored the output to reduce verbosity and ran the full test suite."

📢✨ Before we assign a reviewer:

  • @rtibblesbot will pre-review this pull request. Its comments are generated by an LLM, and should be evaluated accordingly.
  • We'll also invite community pre-review. See the community review guidance for both authors and reviewers.

Also check that issue requirements are satisfied & you ran pre-commit locally.

Pull requests that don't follow the guidelines will be closed.

Reviewer assignment can take up to 2 weeks.

📎 We couldn't find an issue linked to this pull request. Please edit the description and link one under References, for example Fixes #123 or Closes #123. A plain #123 mention doesn't link the PR to the issue.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain, and the change is accompanied by targeted regression coverage for timestamp updates and channel isolation.

No open issues 🎉

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain, and the change includes targeted regression coverage for timestamp updates and channel isolation.

No open issues 🎉

Review effort: Lite

@rtibbles
rtibbles requested a review from rtibblesbot November 18, 2026 17:16
@learning-equality-bot

Copy link
Copy Markdown
Contributor

📢✨ Before we assign a reviewer, we'll turn on @rtibblesbot to pre-review. Its comments are generated by an LLM, and should be evaluated accordingly.

rtibblesbot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Waiting for changes

Outcome: reviewed 2076c17

Last updated: 2026-11-18 17:21 UTC

@rtibblesbot rtibblesbot left a comment

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.

PR #6451 fixes date_updated on both bulk status updates. Bulk update() skips auto_now, so each now sets the field explicitly. Tests cover both paths. They also check that untouched rows keep their timestamps.

CI passing.

Next step: Needs a full code review by a human engineer.

  • The author is outside the team: confirm this should be built at all.

Written by rtibblesbot, an LLM-based coding agent.

@rtibbles rtibbles linked an issue Nov 18, 2026 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Community library status changes don't update date_updated

3 participants