Skip to content
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

Cannot delete taxon trees #5456

Open
grantfitzsimmons opened this issue Dec 10, 2024 · 2 comments · May be fixed by #6186
Open

Cannot delete taxon trees #5456

grantfitzsimmons opened this issue Dec 10, 2024 · 2 comments · May be fixed by #6186
Assignees
Labels
1 - Bug Incorrect behavior of the product 2 - Trees Issues that are related to the tree system and related functionalities.
Milestone

Comments

@grantfitzsimmons
Copy link
Member

grantfitzsimmons commented Dec 10, 2024

Describe the bug
We added the ability to create a new tree, but never gave users the tools to remove them. Now you can create any number of trees but it is impossible to delete them.

!!! For this first version, allow to delete any tree that is not the discipline default

To Reproduce
Steps to reproduce the behavior:

  1. Go to the tree viewer
  2. Add a new tree (e.g. Entomology)
  3. Remove all ranks (except the root), prepare for wrist strain.
  4. Try to delete the root node (see error due to business rules)
    TreeBusinessRuleException
    Can not delete root level tree definition item
    
  5. Try to delete the tree from the form, see error

Expected behavior
If the user can create a tree, they should also be able to remove it. This process should not require the user to delete each rank individually or all of the nodes; the entire tree should be deletable at once.

The taxon tree should be removable if it meets the following criteria:

  • No determinations are linked to nodes present in that tree
  • The tree is not referenced in the discipline table as the default
  • The collection has more than 1 tree
  • The collection's default COT does not link to that tree

Only institution admins should have this capability, else add a permission specifically for tree creation/removal.

Screenshots

Screen.Recording.2024-12-10.at.9.12.51.AM.mov

Crash Report
Uploading Specify 7 Crash Report - 2024-12-10T15_13_39.141Z.txt…

macOS, Arc, production (6b071d7)
geo-swiss.specifycloud.org
spadmin user, Geology discipline

@grantfitzsimmons grantfitzsimmons added 1 - Bug Incorrect behavior of the product 2 - Trees Issues that are related to the tree system and related functionalities. labels Dec 10, 2024
@grantfitzsimmons grantfitzsimmons added this to the 7.9.x milestone Dec 10, 2024
@grantfitzsimmons
Copy link
Member Author

@CarolineDenis Is this something we need to ship alongside the ability to create trees? Seems like we may introduce some issues here if done by accident.

@CarolineDenis CarolineDenis modified the milestones: 7.9.x, 7.9.12 Dec 24, 2024
@CarolineDenis
Copy link
Contributor

NOTES:
We could maybe change the on_delete=protect_with_blockers to on_delete=models.CASCADE for the references to definition in Taxon and TaxonTreeItems.
As well as for definitionitem in taxon
Also need to remove or change the tree bus rule for
@orm_signal_handler('pre_delete')
def cannot_delete_root_treedefitem(sender, obj):

@CarolineDenis CarolineDenis self-assigned this Jan 31, 2025
CarolineDenis added a commit that referenced this issue Jan 31, 2025
@CarolineDenis CarolineDenis linked a pull request Jan 31, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product 2 - Trees Issues that are related to the tree system and related functionalities.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants