Skip to content

Commit

Permalink
doc: updated documentation in CreateCSVCapturesPage
Browse files Browse the repository at this point in the history
  • Loading branch information
MacQSL committed Sep 9, 2024
1 parent 17fdd50 commit 527ec77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/src/components/file-upload/FileUploadSingleItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ type FileUploadSingleItemProps = {
* `FileUploadSingleItem` a stateless component with full control of the file upload process via props.
* Implements multiple callback functions to explictly handle events during the file upload.
*
* Note: This is different than the `FileUpload` component where the state is handled internally.
* Note: This is different than the `FileUpload` component where the state is handled internally, and
* supports multiple file uploads.
*
* @param {FileUploadSingleItemProps} props
* @returns {*}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const CreateCSVCapturesPage = () => {
} catch (error: any) {
handleFileState({ fileType, status: UploadFileStatus.FAILED, error: error.message ?? 'Unknown error' });

return UploadFileStatus.FAILED;
return UploadFileStatus.FAILED; // Return the final status to prevent race conditions with state

Check warning on line 112 in app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx#L112

Added line #L112 was not covered by tests
}
}
return files[fileType].status;

Check warning on line 115 in app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx#L115

Added line #L115 was not covered by tests
Expand All @@ -128,10 +128,12 @@ export const CreateCSVCapturesPage = () => {
const handleAllFileUploads = async () => {
const cancelToken = axios.CancelToken.source();

Check warning on line 129 in app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx#L128-L129

Added lines #L128 - L129 were not covered by tests

// Attempt to upload the captures first
const captureUploadStatus = await handleFileUpload('captures', (file, onProgress) =>
biohubApi.survey.importCapturesFromCsv(file, projectId, surveyId, cancelToken, onProgress)

Check warning on line 133 in app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx#L132-L133

Added lines #L132 - L133 were not covered by tests
);

// If the Captures CSV upload failed, don't attempt to upload Measurements or Markings
if (captureUploadStatus !== UploadFileStatus.FAILED) {
// Measurements / Markings can be uploaded in parallel
await Promise.all([

Check warning on line 139 in app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/features/surveys/animals/profile/captures/import-captures/CreateCSVCapturesPage.tsx#L139

Added line #L139 was not covered by tests
Expand Down

0 comments on commit 527ec77

Please sign in to comment.