Skip to content

Classification grouping - clean up groupings when classifications are deleted #1776 - #1777

Open
davmlaw wants to merge 1 commit into
masterfrom
grouping_delete_1776
Open

Classification grouping - clean up groupings when classifications are deleted #1776#1777
davmlaw wants to merge 1 commit into
masterfrom
grouping_delete_1776

Conversation

@davmlaw

@davmlaw davmlaw commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🤖 Written by Claude

Issue #1776

The pre_delete handler for Classification recalculated the grouping while the ClassificationGroupingEntry still existed (it is only removed by CASCADE when the classification row is deleted), so ClassificationGrouping.update() still counted the doomed classification, re-saved the grouping with dirty=False, and the "no classifications → delete grouping" branch never ran. Deleting classifications left stale, empty groupings behind that nothing ever revisited.

The handler now deletes the entry explicitly before dirtying the grouping and running the instant recalculation — mirroring what assign_grouping_for_classification already does in its no-allele branch — so the recount excludes the deleted classification and empty groupings clean themselves up.

Existing orphaned groupings on deployments can be cleaned up with python3 manage.py classification_groupings --refresh.

🤖 Generated with Claude Code

…on classification delete, so empty groupings are cleaned up #1776
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.

1 participant