Skip to content

Commit

Permalink
fix: force apprenticeship to null if applicannt has no granted pay su…
Browse files Browse the repository at this point in the history
…bsidy
  • Loading branch information
sirtawast committed Apr 3, 2024
1 parent d67f6d0 commit 9710811
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import useFormActions from 'benefit/applicant/hooks/useFormActions';
import useUpdateApplicationQuery from 'benefit/applicant/hooks/useUpdateApplicationQuery';
import { useTranslation } from 'benefit/applicant/i18n';
import { getApplicationStepString } from 'benefit/applicant/utils/common';
import { APPLICATION_STATUSES } from 'benefit-shared/constants';
import {
APPLICATION_STATUSES,
PAY_SUBSIDY_GRANTED,
} from 'benefit-shared/constants';
import { Application, ApplicationData } from 'benefit-shared/types/application';
import { useRouter } from 'next/router';
import { TFunction } from 'next-i18next';
Expand Down Expand Up @@ -99,6 +102,10 @@ const useApplicationFormStep5 = (
{
...application,
...submitFields,
apprenticeshipProgram:
application?.paySubsidyGranted === PAY_SUBSIDY_GRANTED.NOT_GRANTED
? null
: application?.apprenticeshipProgram,
calculation: application.calculation
? {
...application.calculation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import useUpdateApplicationQuery from 'benefit/applicant/hooks/useUpdateApplicat
import { useTranslation } from 'benefit/applicant/i18n';
import {
APPLICATION_STATUSES,
PAY_SUBSIDY_GRANTED,
VALIDATION_MESSAGE_KEYS,
} from 'benefit-shared/constants';
import {
Expand Down Expand Up @@ -92,6 +93,10 @@ const useApplicationFormStep6 = (
(consent) => consent.id
),
},
apprenticeshipProgram:
application?.paySubsidyGranted === PAY_SUBSIDY_GRANTED.NOT_GRANTED
? null
: application?.apprenticeshipProgram,
status:
application.status === APPLICATION_STATUSES.DRAFT
? APPLICATION_STATUSES.RECEIVED
Expand Down

0 comments on commit 9710811

Please sign in to comment.