Skip to content

added duplicate clause in move.py#1098

Merged
audiodude merged 10 commits intoopenzim:mainfrom
arnchlmcodes:added-duplicate-clause
Mar 25, 2026
Merged

added duplicate clause in move.py#1098
audiodude merged 10 commits intoopenzim:mainfrom
arnchlmcodes:added-duplicate-clause

Conversation

@arnchlmcodes
Copy link
Copy Markdown
Contributor

Added an ON DUPLICATE KEY UPDATE clause to move.py which updates m_new_namespace and m_new_article

as discussed in #101

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.78%. Comparing base (df62769) to head (cdfd76d).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1098   +/-   ##
=======================================
  Coverage   92.78%   92.78%           
=======================================
  Files          74       74           
  Lines        4311     4311           
=======================================
  Hits         4000     4000           
  Misses        311      311           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@audiodude audiodude left a comment

Choose a reason for hiding this comment

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

This looks good, and existing tests pass. Honestly though, this should come with a "failing test", aka a test that demonstrates the issue and is failing at HEAD, but works in the PR. Up to you.

@arnchlmcodes
Copy link
Copy Markdown
Contributor Author

Hi @audiodude, added a failing test as requested. The test inserts an initial move record, verifies it was inserted correctly, then inserts a second move with the same primary key but different destination fields. It then checks whether the record was updated with the new values from move2 rather than raising an IntegrityError. Let me know if any changes are required :)

Copy link
Copy Markdown
Member

@audiodude audiodude left a comment

Choose a reason for hiding this comment

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

THanks for the test, definitely the right idea!

Unfortunately you have accidentally made more work for yourself, but the end result wil be much stronger.

@audiodude audiodude force-pushed the added-duplicate-clause branch from c5664fb to 22e5bde Compare March 24, 2026 04:48
@audiodude
Copy link
Copy Markdown
Member

Failing Black format, please fix.

@arnchlmcodes
Copy link
Copy Markdown
Contributor Author

My bad, added black formatting now

@audiodude audiodude merged commit 5f11b2e into openzim:main Mar 25, 2026
6 checks passed
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.

2 participants