Skip to content

Commit

Permalink
MCR-4791: Add rate withdraw actions to change history table (#3064)
Browse files Browse the repository at this point in the history
* use the incoming withdraw reason

* make changes to change history table

* Add test

* prepend text that includes id of withdrawn rate to submit and unlock reason for rate withdraw

* use destructured updatedReason

* Add withdraw reason to rate submit. Add tests for contract and rate reasons for update and submit.

---------

Co-authored-by: Jason Lin <[email protected]>
  • Loading branch information
pearl-truss and JasonLin0991 authored Jan 13, 2025
1 parent a5367ec commit 47abff4
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const withdrawRateInsideTransaction = async (
const unlockedContract = await unlockContractInsideTransaction(tx, {
contractID: contract.id,
unlockedByUserID: updatedByID,
unlockReason: `CMS withdrawing rate ${latestRateRev.rateCertificationName} from this submission`,
unlockReason: `CMS withdrawing rate ${latestRateRev.rateCertificationName} from this submission. ${updatedReason}`,
})

if (unlockedContract instanceof Error) {
Expand Down Expand Up @@ -259,7 +259,7 @@ const withdrawRateInsideTransaction = async (
const resubmitContractArgs: SubmitContractArgsType = {
contractID: contract.id,
submittedByUserID: updatedByID,
submittedReason: `CMS has withdrawn rate ${latestRateRev.rateCertificationName} from this submission`,
submittedReason: `CMS has withdrawn rate ${latestRateRev.rateCertificationName} from this submission. ${updatedReason}`,
}
const resubmitResult = await submitContractInsideTransaction(
tx,
Expand All @@ -276,7 +276,7 @@ const withdrawRateInsideTransaction = async (
rateID,
formData: undefined,
submittedByUserID: updatedByID,
submittedReason: 'CMS has withdrawn this rate',
submittedReason: 'CMS has withdrawn this rate. ' + updatedReason,
})

if (submitRate instanceof Error) {
Expand Down
36 changes: 34 additions & 2 deletions services/app-api/src/resolvers/rate/withdrawRate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ describe('withdrawRate', () => {
})

const contract = await createAndSubmitTestContractWithRate(stateServer)
const rateID = contract.packageSubmissions[0].rateRevisions[0].rateID
const rate = contract.packageSubmissions[0].rateRevisions[0]
const rateID = rate.rateID
const rateName = rate.formData.rateCertificationName
const updatedReason = 'Withdraw invalid rate'

const withdrawnRate = await withdrawTestRate(
cmsServer,
rateID,
'Withdraw invalid rate'
updatedReason
)

// expect rate to contain contract in withdrawn join table
Expand Down Expand Up @@ -120,6 +124,20 @@ describe('withdrawRate', () => {
])
)

const latestRateRev = withdrawnRate.packageSubmissions[0].rateRevision
const rateUnlockInfo = latestRateRev.unlockInfo
const rateSubmitInfo = latestRateRev.submitInfo

// expect the rate latest unlock info to contain default text and withdraw reason
expect(rateUnlockInfo?.updatedReason).toBe(
`CMS withdrawing rate ${rateName} from this submission. ${updatedReason}`
)

// expect rate latest submission to contain default text and withdraw reason
expect(rateSubmitInfo?.updatedReason).toBe(
`CMS has withdrawn this rate. ${updatedReason}`
)

const contractWithWithdrawnRate = await fetchTestContractWithQuestions(
stateServer,
contract.id
Expand All @@ -141,6 +159,10 @@ describe('withdrawRate', () => {
)

const packageSubmissions = contractWithWithdrawnRate.packageSubmissions
const contractSubmitInfo =
packageSubmissions[0].contractRevision.submitInfo
const contractUnlockInfo =
packageSubmissions[0].contractRevision.unlockInfo

// expect withdrawn rate is no longer in latest package submission
expect(packageSubmissions[0].rateRevisions).not.toEqual(
Expand All @@ -151,6 +173,16 @@ describe('withdrawRate', () => {
])
)

// expect the contacts latest unlock info to contain default text and withdraw reason
expect(contractUnlockInfo?.updatedReason).toBe(
`CMS withdrawing rate ${rateName} from this submission. ${updatedReason}`
)

// expect contracts latest submission to contain default text and withdraw reason
expect(contractSubmitInfo?.updatedReason).toBe(
`CMS has withdrawn rate ${rateName} from this submission. ${updatedReason}`
)

// expect the withdrawn rate is on the previous packageSubmission
expect(packageSubmissions[1].rateRevisions).toEqual(
expect.arrayContaining([
Expand Down
122 changes: 122 additions & 0 deletions services/app-web/src/components/ChangeHistory/ChangeHistory.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
mockValidCMSUser,
mockValidStateUser,
mockContractPackageApproved,
mockContractWithLinkedRateSubmitted,
} from '@mc-review/mocks'
import { renderWithProviders } from '../../testHelpers'
import { formatToPacificTime } from '@mc-review/dates'
Expand Down Expand Up @@ -95,6 +96,127 @@ describe('Change History', () => {
expect(screen.getByText('Approved')).toBeInTheDocument()
})

it('has expected text in the accordion titles and content for rate withdrawal', () => {
const contractWithWithdrawnRate = mockContractWithLinkedRateSubmitted({
packageSubmissions: [
{
cause: 'CONTRACT_SUBMISSION',
__typename: 'ContractPackageSubmission',
submitInfo: {
updatedAt: new Date('12/18/2023'),
updatedBy: {
email: '[email protected]',
role: 'STATE_USER',
givenName: 'John',
familyName: 'Vila',
},
updatedReason: 'withdraw rate',
},
submittedRevisions: [],
contractRevision: {
contractName: 'MCR-MN-0005-SNBC',
createdAt: new Date('01/01/2024'),
updatedAt: new Date('12/31/2024'),
id: '123',
contractID: 'test-abc-123',
submitInfo: {
updatedAt: new Date('12/18/2023'),
updatedBy: {
email: '[email protected]',
role: 'STATE_USER',
givenName: 'John',
familyName: 'Vila',
},
updatedReason: 'withdraw rate',
},
unlockInfo: {
updatedAt: new Date('12/18/2023'),
updatedBy: {
email: '[email protected]',
role: 'STATE_USER',
givenName: 'John',
familyName: 'Vila',
},
updatedReason: 'withdraw rate',
},
formData: {
programIDs: [
'abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce',
],
populationCovered: 'MEDICAID',
submissionType: 'CONTRACT_AND_RATES',
riskBasedContract: true,
submissionDescription: 'A real submission',
supportingDocuments: [
{
s3URL: 's3://bucketname/key/contractsupporting1',
sha256: 'fakesha',
name: 'contractSupporting1',
dateAdded: new Date('01/15/2024'),
},
{
s3URL: 's3://bucketname/key/contractSupporting2',
sha256: 'fakesha',
name: 'contractSupporting2',
dateAdded: new Date('01/13/2024'),
},
],
stateContacts: [],
contractType: 'AMENDMENT',
contractExecutionStatus: 'EXECUTED',
contractDocuments: [
{
s3URL: 's3://bucketname/key/contract',
sha256: 'fakesha',
name: 'contract',
dateAdded: new Date('01/01/2024'),
},
],
contractDateStart: new Date(),
contractDateEnd: new Date(),
managedCareEntities: ['MCO'],
federalAuthorities: ['STATE_PLAN'],
inLieuServicesAndSettings: true,
modifiedBenefitsProvided: true,
modifiedGeoAreaServed: false,
modifiedMedicaidBeneficiaries: true,
modifiedRiskSharingStrategy: true,
modifiedIncentiveArrangements: false,
modifiedWitholdAgreements: false,
modifiedStateDirectedPayments: true,
modifiedPassThroughPayments: true,
modifiedPaymentsForMentalDiseaseInstitutions: false,
modifiedMedicalLossRatioStandards: true,
modifiedOtherFinancialPaymentIncentive: false,
modifiedEnrollmentProcess: true,
modifiedGrevienceAndAppeal: false,
modifiedNetworkAdequacyStandards: true,
modifiedLengthOfContract: false,
modifiedNonRiskPaymentArrangements: true,
statutoryRegulatoryAttestation: true,
statutoryRegulatoryAttestationDescription:
'everything meets regulatory attestation',
},
},
rateRevisions: [],
},
],
})
renderWithProviders(
<ChangeHistory contract={contractWithWithdrawnRate} />
)
const submitInfo =
contractWithWithdrawnRate.packageSubmissions[0].submitInfo
const updatedAt = submitInfo.updatedAt
// API returns UTC timezone, we display timestamped dates in PT timezone so 1 day before on these tests.
expect(
screen.getByRole('button', {
name: `${formatToPacificTime(updatedAt)} - Submission`,
})
).toBeInTheDocument()
expect(screen.getAllByText(/withdraw rate/)).toHaveLength(2)
})

it('has expected text in the accordion titles and content for ADMIN events', () => {
const submittedContract = mockContractPackageSubmittedWithRevisions({
packageSubmissions: [
Expand Down

0 comments on commit 47abff4

Please sign in to comment.