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

Reset deprectatedRateProgramIDs on resubmitted submissions #2468

Merged
merged 8 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function prismaRateCreateFormDataFromDomain(
amendmentEffectiveDateStart: rateFormData.amendmentEffectiveDateStart,
amendmentEffectiveDateEnd: rateFormData.amendmentEffectiveDateEnd,
rateProgramIDs: rateFormData.rateProgramIDs,
deprecatedRateProgramIDs: [],
rateCertificationName: rateFormData.rateCertificationName,
rateDocuments: {
create:
Expand Down Expand Up @@ -90,6 +91,7 @@ function prismaUpdateRateFormDataFromDomain(
rateFormData.amendmentEffectiveDateEnd
),
rateProgramIDs: emptify(rateFormData.rateProgramIDs),
deprecatedRateProgramIDs: [],
rateCertificationName: nullify(rateFormData.rateCertificationName),
rateDocuments: {
deleteMany: {},
Expand Down
6 changes: 3 additions & 3 deletions services/app-web/src/components/DataDetail/DataDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export const DataDetail = ({
<div className={styles.dataDetail}>
<dt id={id}>{label}</dt>
<dd role="definition" aria-labelledby={id}>
{handleArray ? (
children.join(', ').toUpperCase()
) : explainMissingData && noData ? (
{explainMissingData && noData ? (
<DataDetailMissingField />
) : handleArray ? (
children.join(', ').toUpperCase()
) : (
children
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,14 @@ describe('SingleRateSummarySection', () => {
{
rateType: undefined,
rateDateCertified: undefined,
rateProgramIDs: [],
} as unknown as Partial<RateRevision>,
{ status: 'UNLOCKED' }
)
rateData.revisions[0].formData.deprecatedRateProgramIDs = [
rateData.state.programs[0].id,
]
rateData.revisions[0].formData.rateProgramIDs = []
renderWithProviders(
<SingleRateSummarySection
rate={rateData}
Expand Down Expand Up @@ -354,7 +359,7 @@ describe('SingleRateSummarySection', () => {

expect(
await screen.findAllByText(/You must provide this information/)
).toHaveLength(2)
).toHaveLength(3)
})

describe('Unlock rate', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ export const SingleRateSummarySection = ({
)}
<dl>
<DoubleColumnGrid>
{rate.revisions[0].formData.deprecatedRateProgramIDs
.length > 0 &&
{formData.deprecatedRateProgramIDs.length > 0 &&
isSubmitted && (
<DataDetail
id="historicRatePrograms"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ describe('SubmissionTypeSummarySection', () => {
expect(
screen.getByRole('link', { name: 'Edit MN-PMAP-0001' })
).toHaveAttribute('href', '/submission-type')

// Our mocks use the latest package data by default.
// Therefore we can check here that missing field is not being displayed unexpectedly
expect(
screen.queryByText(/You must provide this information/)
).toBeNull()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this because this is a v1 file, the v2 version is passing for this assertion

})

it('can render submitted package without errors', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,40 @@ describe('RateDetailsSummarySection', () => {
})
})

it('displays missing info text for unlocked submissions with only historic rate program ids', async () => {
const draftContract = mockContractPackageDraft()
if (
draftContract.draftRevision &&
draftContract.draftRates &&
draftContract.draftRates[0].draftRevision
) {
draftContract.draftRates[0].draftRevision.formData.deprecatedRateProgramIDs =
[statePrograms[0].id]
draftContract.draftRates[0].draftRevision.formData.rateProgramIDs =
[]
}

renderWithProviders(
<RateDetailsSummarySection
contract={draftContract}
editNavigateTo="rate-details"
submissionName="MN-PMAP-0001"
statePrograms={statePrograms}
/>,
{
apolloProvider,
}
)
await waitFor(() => {
expect(
screen.getByText(/You must provide this information/)
).toBeInTheDocument()
expect(
screen.queryByText(/Programs this rate certification covers/)
).not.toBeInTheDocument()
})
})

it('renders inline error when bulk URL is unavailable', async () => {
const s3Provider = {
...testS3Client(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ export const RateDetailsSummarySectionV2 = ({
isSubmittedOrCMSUser,
isPreviousSubmission,
])

return (
<SectionCard id="rateDetails" className={styles.summarySection}>
<SectionHeader
Expand Down Expand Up @@ -263,7 +262,7 @@ export const RateDetailsSummarySectionV2 = ({
</h3>
<dl>
<DoubleColumnGrid>
{rate.formData.deprecatedRateProgramIDs
{rateFormData.deprecatedRateProgramIDs
.length > 0 &&
isSubmitted && (
<DataDetail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export const ReviewSubmitV2 = (): React.ReactElement => {
contractFormData.programIDs,
programs
) || ''

return (
<>
<div className={styles.stepIndicator}>
Expand Down
Loading