-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add business rule to validate Determination taxon with COType #5127
Conversation
Triggered by 31f59c5 on branch refs/heads/issue-5111
Triggered by bc75fd0 on branch refs/heads/issue-5111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While there is functionally nothing wrong with this Business Rule, I don't think it addresses what the requirement initially was for #5111:
When creating a new Determination record, the system should check the objectType.taxonTreeDef field to find the tree to search for the user's entered name when searching in the taxon or preferredTaxon query combo boxes
I think the implementation of this would be to scope the results of the Taxon QueryComboBox to the correct tree depending on the objectType
.
Is this functionality going to be included in another PR?
Right now from the changes in stored_queries/execution.py
, I think the returned results from the QueryComboBox are from all Taxon Trees.
Is this the new requirement? To return all Taxon records when searching and instead have this businessrule to determine whether the determination is correct or not?
This is not the ideal from the user perspective, but it does eliminate a lot of complexity.
Still, if this the approach we are going with then I think we can further improve quality-of-life (such as by ordering the results of the QueryComboBox by Tree).
(Conceptually, wouldn't the ideal implementation default the filtering of results in QueryComboBoxes for Taxon records to the TaxonTreeDef on Collection -> TaxonTreeDef
? On the Determination Form/SubView, we can then further filter the results based on the CollectionObject -> coType -> taxonTreeDef
.
Definitely not easy, but if we go with a simpler, less complex approach I think we should still try and make it as intuitive as possible).
specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts
Outdated
Show resolved
Hide resolved
specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts
Outdated
Show resolved
Hide resolved
specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Jason Melton <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #5036 (review)
Co-authored by: Sharad S <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing the PR
- Make sure to use a db with multiple trees in the same discipline and multiple COTypes in the same collection
- Go to the CO form
- Select a COType
- Add a determination
- Choose a Taxon which does not belong to the COType's treeDefiniton
- Verify save is blocked
- Choose a Taxon which belongs to the COType's treeDefiniton
- Verify save is enabled
Looks good, works as expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing the PR
- Make sure to use a db with multiple trees in the same discipline and multiple COTypes in the same collection
- Go to the CO form
- Select a COType
- Add a determination
- Choose a Taxon which does not belong to the COType's treeDefiniton
- Verify save is blocked
- Choose a Taxon which belongs to the COType's treeDefiniton
- Verify save is enabled
This pull request has been mentioned on Specify Community Forum. There might be relevant details there: https://discourse.specifysoftware.org/t/specify-7-9-7-release-announcement/1979/1 |
Fixes #5111
Using business rules to check whether treeDef of a Determination Taxon is same as treeDef of the selected COType in a CO form. Save is blocked if they are not the same.
Checklist
and self-explanatory (or properly documented)
Testing instructions
Set up the COType field in the CO form
Ideally, COType would be set as a picklist. However, until #5098 is fixed, it is not possible to configure one for COType. Instead for this PR, COType can be set up as a QCBX.
.views
file for the collection you are in<row>
:Your CO form should look something like this
Testing the PR