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

[Dataquery] return beneath regex #9724

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions modules/dataquery/jsx/definefilters.importcsvmodal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {FileElement} from 'jsx/Form';

/**
* Render a modal window for adding a filter
*
* @param {object} props - React props
* @param {function} props.setQuery - Function to set the current criteria
* @param {function} props.closeModal - Callback to close the current modal
Expand All @@ -23,7 +22,6 @@ function ImportCSVModal(props: {
const [idType, setIdType] = useState<string>('PSCID');
/**
* Promise for handling modal closing. Always accepts.
*
* @returns {Promise} - a stub promise
*/
const submitPromise = () =>
Expand All @@ -36,7 +34,6 @@ function ImportCSVModal(props: {

/**
* Callback function for after papaparse has parsed the csv
*
* @param {any} value - the value from papaparse callback
*/
const csvParsed = (value: Papa.ParseResult<any>) => {
Expand All @@ -53,6 +50,7 @@ function ImportCSVModal(props: {
// If sessions: validate 2 columns
const expectedLength = (csvType === 'session' ? 2 : 1);
const startLine = csvHeader ? 1 : 0;

for (let i = startLine; i < value.data.length; i++) {
if (value.data[i].length != expectedLength) {
swal.fire({
Expand All @@ -73,6 +71,7 @@ function ImportCSVModal(props: {
+ ') on line '
+ (i+1) + '.',
});
return;
}
}
}
Expand Down
Loading