[dataquery] CSV upload - CandID regex check #9722
Labels
27.0.0 - Bugs
Bugs Found in LORIS 27 testing
Module: dataquery
PR or issue related to (new) dataquery module
Milestone
Describe the bug
Not so a much a bug as simply a confusing message.
To Reproduce
Steps to reproduce the behavior (attach screenshots if applicable):
Continue to Define Fields
Add Filters
from TheNext Steps
tab at bottom right of screenImport from CSV
Import the following CSV file: pscid.csv
The following error message is shown:
What did you expect to happen?
This is a PSCID and not a DCCID, so, it will not pass the CandID regex check defined on line 35 of
https://github.com/aces/Loris/blob/main/modules/dataquery/jsx/definefilters.importcsvmodal.tsx
const candIDRegex = new RegExp('^[1-9][0-9]{5}$');
which is looking for 5 digits where first is not
0
and invoked on line 68 of the forloop (i think of this as a while loop)
I expected the error to be thrown at line 1 (index 0). I think the issue is that the governing function returns before this check takes place. So the following regex if-code block does not return after the first error. instead, it continues through the entire list because each error replaces the last one, and it will just give you the last row. So i think a second return statement should come after the CandID regex check.
Browser Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: