fix(trees): handle synonymization in save#8085
Draft
grantfitzsimmons wants to merge 3 commits into
Draft
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| try: | ||
| old_taxon = Taxon.objects.get(pk=self.pk) | ||
| old_accepted_id = old_taxon.acceptedtaxon_id | ||
| except Taxon.DoesNotExist: |
|
|
||
| # Update Determinations where this Taxon is already the preferred taxon | ||
| # Use lazy import to avoid circular import issues (same pattern as extras.py) | ||
| from specifyweb.specify.models import Determination |
|
|
||
| # Update Determinations where this Taxon is the preferred taxon | ||
| # to use themselves as the preferred taxon | ||
| from specifyweb.specify.models import Determination |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6810
Fixes an issue where
Determination.preferredTaxondidn't update when a Taxon's Accepted/Preferred taxon is changed via the Taxon form or API. Changes make all code-paths that changeAcceptedIDbehave like the TreeViewer synonymize/desynonymize action.By handling
AcceptedIDchanges at the model layer, any code path that updates a Taxon'sAcceptedID(UI form, API) will trigger the same Determination and child updates. This prevents the stale PreferredTaxon values previously seen in queries.Root Cause
extras.synonymize()/desynonymize()) updatedDetermination.preferredTaxon, but direct updates to a Taxon'sAcceptedID(e.g., via the Taxon form) only saved the Taxon record and did not propagate the change to Determinations or accepted children.Currently working on handling the collection preferences for synonyms
Checklist
self-explanatory (or properly documented)
Testing instructions
main, create a determination for TaxonA, setA.AcceptedTaxon→Bvia the Taxon form, then confirmDetermination.preferredTaxonstill points toAuntil the determination is manually edited.issue-6810branch:preferredTaxon=A.A.acceptedTaxon=Band save.Determination.preferredTaxonnow equalsB.A.acceptedTaxon= None and save.Determination.preferredTaxonequals theDetermination.taxon(A).