Skip to content

Commit

Permalink
fix: nonfunctional alteration submission and misc. oversights in date…
Browse files Browse the repository at this point in the history
… overlap detection (#3068)

* fix: nonfunctional alteration submission

* fix: disregard cancelled alterations in overlap check

* fix: check for recovery date range in overlap check if set

* fix: don't consider cancelled alterations in overlap check
  • Loading branch information
EmiliaMakelaVincit authored Jun 5, 2024
1 parent c316246 commit 9e7dfb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def _validate_date_range_overlaps(self, self_id, application, start_date, end_da
if (
alteration.recovery_start_date is None
or alteration.recovery_end_date is None
or alteration.state == ApplicationAlterationState.CANCELLED
):
continue

Expand Down Expand Up @@ -255,9 +256,15 @@ def validate(self, data):
application, alteration_start_date, alteration_end_date
)

if alteration_end_date is not None:
if (
alteration_end_date is not None
and merged_data["state"] != ApplicationAlterationState.CANCELLED
):
errors += self._validate_date_range_overlaps(
self_id, application, alteration_start_date, alteration_end_date
self_id,
application,
merged_data["recovery_start_date"] or alteration_start_date,
merged_data["recovery_end_date"] or alteration_end_date,
)

if len(errors) > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const useAlterationHandling = ({
isSubmitting: updateStatus === 'loading',
t,
formik,
handleAlteration: () => void formik.submitForm,
handleAlteration: () => void formik.submitForm(),
validateForm,
};
};
Expand Down

0 comments on commit 9e7dfb9

Please sign in to comment.