From 7246db8f5a9efe70c0c8eb42293a93f9dc13f3e4 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 28 May 2024 13:43:16 -0400 Subject: [PATCH 1/8] reset deprectatedRateProgramIDs on update rates and display missing info on reviewSubmit --- .envrc | 5 ++++- .../contractAndRates/prismaSharedContractRateHelpers.ts | 2 +- .../V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx | 9 +++++++-- .../ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx | 1 - 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.envrc b/.envrc index df9a64b8c4..c2a731043e 100644 --- a/.envrc +++ b/.envrc @@ -24,7 +24,7 @@ export REACT_APP_S3_DOCUMENTS_BUCKET='local-uploads' export REACT_APP_S3_QA_BUCKET='local-qa' export DATABASE_URL='postgresql://postgres:shhhsecret@localhost:5432/postgres?schema=public&connection_limit=5' # pragma: allowlist secret export EMAILER_MODE='LOCAL' -export LD_SDK_KEY='this-value-must-be-set-in-local' +export LD_SDK_KEY='sdk-9f6315a3-ad22-4af8-9e21-b5caf2e12b98' export PARAMETER_STORE_MODE='LOCAL' export ALLOWED_IP_ADDRESSES='127.0.0.1' export JWT_SECRET='3fd2e448ed2cec1fa46520f1b64bcb243c784f68db41ea67ef9abc45c12951d3e770162829103c439f01d2b860d06ed0da1a08895117b1ef338f1e4ed176448a' # pragma: allowlist secret @@ -36,6 +36,9 @@ export REACT_APP_NR_ACCOUNT_ID='this-value-is-ignored-local-but-used-in-deployed export REACT_APP_NR_TRUST_KEY='this-value-is-ignored-local-but-used-in-deployed-env' export REACT_APP_NR_LICENSE_KEY='this-value-is-ignored-local-but-used-in-deployed-env' export REACT_APP_NR_AGENT_ID='this-value-is-ignored-local-but-used-in-deployed-env' +export REACT_APP_OTEL_COLLECTOR_URL='http://localhost:4318/v1/traces' +export REACT_APP_LD_CLIENT_ID='63485400b65ea55ac7f27e94' + # Sources a local overrides file. You can export any variables you # need for your local setup there. Any that match variables set here # will overwrite them. diff --git a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts index 95c2778823..fddbf9a0e5 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts @@ -203,7 +203,7 @@ function rateFormDataToDomainModel( amendmentEffectiveDateEnd: rateRevision.amendmentEffectiveDateEnd ?? undefined, rateProgramIDs: rateRevision.rateProgramIDs, - deprecatedRateProgramIDs: rateRevision.deprecatedRateProgramIDs, + deprecatedRateProgramIDs: [], rateCertificationName: rateRevision.rateCertificationName ?? undefined, certifyingActuaryContacts: rateRevision.certifyingActuaryContacts ? rateRevision.certifyingActuaryContacts.map((actuary) => ({ diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx index 7f6e1c683f..40a6d0a78c 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx @@ -233,7 +233,6 @@ export const RateDetailsSummarySectionV2 = ({ isSubmittedOrCMSUser, isPreviousSubmission, ]) - return ( 0 + ? null + : ratePrograms(rate, false) + } /> )} { contractFormData.programIDs, programs ) || '' - return ( <>
From 7d990a07ac9341af93c61b2a0298c4646527f0d3 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 28 May 2024 19:45:31 -0400 Subject: [PATCH 2/8] reset envrc --- .envrc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.envrc b/.envrc index c2a731043e..df9a64b8c4 100644 --- a/.envrc +++ b/.envrc @@ -24,7 +24,7 @@ export REACT_APP_S3_DOCUMENTS_BUCKET='local-uploads' export REACT_APP_S3_QA_BUCKET='local-qa' export DATABASE_URL='postgresql://postgres:shhhsecret@localhost:5432/postgres?schema=public&connection_limit=5' # pragma: allowlist secret export EMAILER_MODE='LOCAL' -export LD_SDK_KEY='sdk-9f6315a3-ad22-4af8-9e21-b5caf2e12b98' +export LD_SDK_KEY='this-value-must-be-set-in-local' export PARAMETER_STORE_MODE='LOCAL' export ALLOWED_IP_ADDRESSES='127.0.0.1' export JWT_SECRET='3fd2e448ed2cec1fa46520f1b64bcb243c784f68db41ea67ef9abc45c12951d3e770162829103c439f01d2b860d06ed0da1a08895117b1ef338f1e4ed176448a' # pragma: allowlist secret @@ -36,9 +36,6 @@ export REACT_APP_NR_ACCOUNT_ID='this-value-is-ignored-local-but-used-in-deployed export REACT_APP_NR_TRUST_KEY='this-value-is-ignored-local-but-used-in-deployed-env' export REACT_APP_NR_LICENSE_KEY='this-value-is-ignored-local-but-used-in-deployed-env' export REACT_APP_NR_AGENT_ID='this-value-is-ignored-local-but-used-in-deployed-env' -export REACT_APP_OTEL_COLLECTOR_URL='http://localhost:4318/v1/traces' -export REACT_APP_LD_CLIENT_ID='63485400b65ea55ac7f27e94' - # Sources a local overrides file. You can export any variables you # need for your local setup there. Any that match variables set here # will overwrite them. From b98624ec554c7f5f2f54c609dff3ca21a758d269 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 29 May 2024 10:48:52 -0400 Subject: [PATCH 3/8] fix issue with deprecatedRateProgramIDs not being reset --- .../postgres/contractAndRates/prismaContractRateAdaptors.ts | 2 ++ .../contractAndRates/prismaSharedContractRateHelpers.ts | 2 +- .../V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/app-api/src/postgres/contractAndRates/prismaContractRateAdaptors.ts b/services/app-api/src/postgres/contractAndRates/prismaContractRateAdaptors.ts index 1953ea625c..e5078c8dfd 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaContractRateAdaptors.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaContractRateAdaptors.ts @@ -39,6 +39,7 @@ function prismaRateCreateFormDataFromDomain( amendmentEffectiveDateStart: rateFormData.amendmentEffectiveDateStart, amendmentEffectiveDateEnd: rateFormData.amendmentEffectiveDateEnd, rateProgramIDs: rateFormData.rateProgramIDs, + deprecatedRateProgramIDs: [], rateCertificationName: rateFormData.rateCertificationName, rateDocuments: { create: @@ -90,6 +91,7 @@ function prismaUpdateRateFormDataFromDomain( rateFormData.amendmentEffectiveDateEnd ), rateProgramIDs: emptify(rateFormData.rateProgramIDs), + deprecatedRateProgramIDs: [], rateCertificationName: nullify(rateFormData.rateCertificationName), rateDocuments: { deleteMany: {}, diff --git a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts index fddbf9a0e5..95c2778823 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts @@ -203,7 +203,7 @@ function rateFormDataToDomainModel( amendmentEffectiveDateEnd: rateRevision.amendmentEffectiveDateEnd ?? undefined, rateProgramIDs: rateRevision.rateProgramIDs, - deprecatedRateProgramIDs: [], + deprecatedRateProgramIDs: rateRevision.deprecatedRateProgramIDs, rateCertificationName: rateRevision.rateCertificationName ?? undefined, certifyingActuaryContacts: rateRevision.certifyingActuaryContacts ? rateRevision.certifyingActuaryContacts.map((actuary) => ({ diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx index 40a6d0a78c..b63579f70c 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx @@ -287,7 +287,9 @@ export const RateDetailsSummarySectionV2 = ({ children={ rate.formData .deprecatedRateProgramIDs - .length > 0 + .length > 0 && + rate.formData.rateProgramIDs + .length === 0 ? null : ratePrograms(rate, false) } From 3fe87246cb1af07be214172167da0bb5a6e79add Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 29 May 2024 14:37:42 -0400 Subject: [PATCH 4/8] add unit test for rateDetailsSummarySection --- .../RateDetailsSummarySectionV2.test.tsx | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.test.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.test.tsx index ed878a9418..b9da99e056 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.test.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.test.tsx @@ -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( + , + { + 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(), From 90edc3b0a7ad8cfb9363ec2746403a61b637cdb9 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Thu, 30 May 2024 07:44:03 -0400 Subject: [PATCH 5/8] update singleratesummarysection test --- .../SingleRateSummarySection.test.tsx | 7 ++++++- .../SingleRateSummarySection.tsx | 20 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx index 4c4db01ac8..43baa6773b 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx @@ -322,9 +322,14 @@ describe('SingleRateSummarySection', () => { { rateType: undefined, rateDateCertified: undefined, + rateProgramIDs: [], } as unknown as Partial, { status: 'UNLOCKED' } ) + rateData.revisions[0].formData.deprecatedRateProgramIDs = [ + rateData.state.programs[0].id, + ] + rateData.revisions[0].formData.rateProgramIDs = [] renderWithProviders( { expect( await screen.findAllByText(/You must provide this information/) - ).toHaveLength(2) + ).toHaveLength(3) }) describe('Unlock rate', () => { diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx index 3b4074501b..8c45ae64b6 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx @@ -254,8 +254,7 @@ export const SingleRateSummarySection = ({ )}
- {rate.revisions[0].formData.deprecatedRateProgramIDs - .length > 0 && + {formData.deprecatedRateProgramIDs.length > 0 && isSubmitted && ( 0 && + rate.revisions[0].formData.rateProgramIDs + .length === 0 + ? null + : ratePrograms( + formData, + statePrograms, + false + ) + } /> )} Date: Thu, 30 May 2024 07:50:12 -0400 Subject: [PATCH 6/8] code clean up --- .../SingleRateSummarySection.tsx | 9 +++++---- .../V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx index 8c45ae64b6..7c33fb5af6 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx @@ -273,10 +273,11 @@ export const SingleRateSummarySection = ({ label="Rates this rate certification covers" explainMissingData={explainMissingData} children={ - rate.revisions[0].formData - .deprecatedRateProgramIDs.length > 0 && - rate.revisions[0].formData.rateProgramIDs - .length === 0 + // explictly set children to null when rate + // only has deprecatedRateProgramIDs + formData.deprecatedRateProgramIDs.length > + 0 && + formData.rateProgramIDs.length === 0 ? null : ratePrograms( formData, diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx index b63579f70c..f984201581 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx @@ -262,7 +262,7 @@ export const RateDetailsSummarySectionV2 = ({
- {rate.formData.deprecatedRateProgramIDs + {rateFormData.deprecatedRateProgramIDs .length > 0 && isSubmitted && ( 0 && - rate.formData.rateProgramIDs + rateFormData.rateProgramIDs .length === 0 ? null : ratePrograms(rate, false) From 46ec119570a3721d2e20074dfcf603ce79cfa765 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Thu, 30 May 2024 16:08:44 -0400 Subject: [PATCH 7/8] pr fix to simplify logic for missing data --- .../src/components/DataDetail/DataDetail.tsx | 2 +- .../SingleRateSummarySection.tsx | 18 +++++------------- .../RateDetailsSummarySectionV2.tsx | 12 +----------- 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/services/app-web/src/components/DataDetail/DataDetail.tsx b/services/app-web/src/components/DataDetail/DataDetail.tsx index 5a0730f39b..1d57c748b0 100644 --- a/services/app-web/src/components/DataDetail/DataDetail.tsx +++ b/services/app-web/src/components/DataDetail/DataDetail.tsx @@ -39,7 +39,7 @@ export const DataDetail = ({
{label}
- {handleArray ? ( + {handleArray && !noData ? ( children.join(', ').toUpperCase() ) : explainMissingData && noData ? ( diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx index 7c33fb5af6..37dcbc242b 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx @@ -272,19 +272,11 @@ export const SingleRateSummarySection = ({ id="ratePrograms" label="Rates this rate certification covers" explainMissingData={explainMissingData} - children={ - // explictly set children to null when rate - // only has deprecatedRateProgramIDs - formData.deprecatedRateProgramIDs.length > - 0 && - formData.rateProgramIDs.length === 0 - ? null - : ratePrograms( - formData, - statePrograms, - false - ) - } + children={ratePrograms( + formData, + statePrograms, + false + )} /> )} 0 && - rateFormData.rateProgramIDs - .length === 0 - ? null - : ratePrograms(rate, false) - } + children={ratePrograms(rate, false)} /> )} Date: Thu, 30 May 2024 16:30:35 -0400 Subject: [PATCH 8/8] clean up code --- services/app-web/src/components/DataDetail/DataDetail.tsx | 6 +++--- .../SubmissionTypeSummarySection.test.tsx | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/services/app-web/src/components/DataDetail/DataDetail.tsx b/services/app-web/src/components/DataDetail/DataDetail.tsx index 1d57c748b0..5f6136f9d6 100644 --- a/services/app-web/src/components/DataDetail/DataDetail.tsx +++ b/services/app-web/src/components/DataDetail/DataDetail.tsx @@ -39,10 +39,10 @@ export const DataDetail = ({
{label}
- {handleArray && !noData ? ( - children.join(', ').toUpperCase() - ) : explainMissingData && noData ? ( + {explainMissingData && noData ? ( + ) : handleArray ? ( + children.join(', ').toUpperCase() ) : ( children )} diff --git a/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.test.tsx b/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.test.tsx index 252c87e7e1..679975cbb0 100644 --- a/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.test.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.test.tsx @@ -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() }) it('can render submitted package without errors', () => {