-
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
Datamodel defaults not being respected in Workbench Tree Matching #6319
Comments
For developer reference, the construction of the query for matching of tree records happened in the below lines: specify7/specifyweb/workbench/upload/treerecord.py Lines 237 to 241 in 08dc104
At a low level of abstraction/cause, the direct cause of the Issue is largely in the construction of the
I'm not familiar enough with the recent upcoming changes to say whether the WorkBench changes for BatchEdit will resolve this Issue, or if it needs to be implemented. |
This issue has been mentioned on Specify Community Forum. There might be relevant details there: https://discourse.specifysoftware.org/t/workbench-wont-match-with-known-species/2398/5 |
Describe the bug
If a tree field which has a default value defined in the datamodel (like
isAccepted
orisHybrid
) is explicitly included in a WorkBench Data Set and does not contain any value for a row (i.e., is blank/null), Specify will still use a NULL value for searching and matching purposes.For a concrete example, consider three columns for any Tree rank in a Data Set:
Genus -> name
,Species -> name
, andSpecies -> isHybrid
, whereSpecies -> isHybrid
has the default matching behavior (Never Ignore, Allow Null Values, and Don't use a Default Value) :In a simplified explanation that demonstrates the Issue, on the first row Specify will search for any existing Genus records with the name
TestGenus
. If one exists, then Specify will match to that record and otherwise creating one. Specify will also search for a Species record which has the nameTestSpecies
, has theTestGenus
parent from the previous step, and has an empty (NULL)isHybrid
- matching to the record if it exists or creating it otherwise (this will always result in creating a new node, as there can not be a Taxon record without anisHybrid
value).When Specify creates the
TestSpecies
node, it "passes through" the datamodel and sees thatisHybrid
has a default value defined: false; Specify replaces the emptyisHybrid
value withfalse
before sending it to the database.The process the repeats for the second row, with the exception in behavior that Specify will always match the
TestGenus
to an existing Taxon record (it matches to the TestGenus of the previous row if it was created).Specify will not match the TestSpecies because it searches for Taxon records with an empty
isHybrid
.duplicate_ranks.mov
To Reproduce
Steps to reproduce the behavior:
isHybrid
orisAccepted
a. Ensure all rows have identical information (same name, author, etc.) for the Tree record mapped with the
isHybrid
/isAccepted
columnsb. Leave the
isHybrid
orisAccepted
columns blankExpected behavior
Specify should do one or more of the following:
NULL
value, replace it with the field's default valueUse Default Value
option checked and filled with the field's default valueCurrent Workarounds
Ignore When Blank
matching behavior for columns mapped to fields with default valuesUse Default Value
option and explicitly define a default for the columnisHybrid
andisAccepted
columnsPlease fill out the following information manually:
Reported By
Fedor Steeman from the Natural History Museum of Denmark via the Speciforum: https://discourse.specifysoftware.org/t/workbench-wont-match-with-known-species/2398
The text was updated successfully, but these errors were encountered: