Skip to content

Commit

Permalink
SIMSBIOHUB 343 - Incorrect date overlap error in sampling methods (#1144
Browse files Browse the repository at this point in the history
)

* Fixed an issue where the yup schema used for editing sampling methods used the wrong field for a date overlap check.
* Removed an unintended required().
* Added a refresh call when submitting sampling method changes so they are reflected in the UI. Otherwise you will still see the previous value if you go back to the sampling methods view even though the new value did save to the db.
  • Loading branch information
GrahamS-Quartech authored and KjartanE committed Oct 27, 2023
1 parent 0c418dc commit 62c44f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/features/surveys/components/EditSamplingMethod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface IEditSamplingMethodProps {

export const SamplingSiteMethodYupSchema = yup.object({
method_lookup_id: yup.number().required(),
description: yup.string().required(),
description: yup.string(),
periods: yup
.array(
yup.object({
Expand All @@ -27,7 +27,7 @@ export const SamplingSiteMethodYupSchema = yup.object({
.required('End date is required')
})
)
.hasUniqueDateRanges('Periods cannot overlap', 'start_date', 'end_state')
.hasUniqueDateRanges('Periods cannot overlap', 'start_date', 'end_date')
.min(1, 'At least one time period is required')
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const SamplingSiteEditPage = () => {

// create complete, navigate back to observations page
history.push(`/admin/projects/${surveyContext.projectId}/surveys/${surveyContext.surveyId}/observations`);
surveyContext.sampleSiteDataLoader.refresh(surveyContext.projectId, surveyContext.surveyId);
} catch (error) {
showCreateErrorDialog({
dialogTitle: CreateSamplingSiteI18N.createErrorTitle,
Expand Down

0 comments on commit 62c44f4

Please sign in to comment.