Skip to content

Fix deletion of touristic content objects in parsers when an m2m constant field is not a list #4838

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

justinefricou
Copy link
Contributor

@justinefricou justinefricou commented Jul 18, 2025

Description

⚠️ Not ready to merge

Unit tests are not complete: they pass even without the fix
-> See FIXME comments in the diffs

Related Issue

In parsers, the value of a many-to-many constant field can be either a string or a list of strings.
TouristicContentMixin, inherited by some parsers, overrides the get_to_delete_kwargs method and only supports lists of strings.
As a result, objects that no longer appear in the source data are not deleted if a string is used as a many-to-many constant field, despite delete = True being set.

This PR adds proper handling for strings as m2m constant field value in parsers that inherit TouristicContentMixin.

Checklist

  • I have followed the guidelines in our Contributing document
  • My code respects the Definition of done available in the Development section of the documentation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes
  • I added an entry in the changelog file
  • My commits are all using prefix convention (emoji + tag name) and references associated issues
  • I added a label to the PR corresponding to the perimeter of my contribution
  • The title of my PR mentionned the issue associated

Copy link

codecov bot commented Jul 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.98%. Comparing base (5ecba35) to head (66154bb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4838      +/-   ##
==========================================
- Coverage   98.47%   93.98%   -4.49%     
==========================================
  Files         273      273              
  Lines       22256    22260       +4     
==========================================
- Hits        21916    20921     -995     
- Misses        340     1339     +999     

☔ 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

cypress bot commented Jul 18, 2025

Geotrek-admin    Run #13400

Run Properties:  status check passed Passed #13400  •  git commit d9f135956e ℹ️: Merge 66154bbc7555980b3e2f9689f1e9ad0ed020fbbb into 5ecba35486932fb46418f376014a...
Project Geotrek-admin
Branch Review refs/pull/4838/merge
Run status status check passed Passed #13400
Run duration 02m 10s
Commit git commit d9f135956e ℹ️: Merge 66154bbc7555980b3e2f9689f1e9ad0ed020fbbb into 5ecba35486932fb46418f376014a...
Committer Justine Fricou
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 22
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant