diff --git a/services/app-api/src/domain-models/contractAndRates/convertContractWithRatesToHPP.ts b/services/app-api/src/domain-models/contractAndRates/convertContractWithRatesToHPP.ts index 0ad2968a29..c9ccbb8bf8 100644 --- a/services/app-api/src/domain-models/contractAndRates/convertContractWithRatesToHPP.ts +++ b/services/app-api/src/domain-models/contractAndRates/convertContractWithRatesToHPP.ts @@ -17,6 +17,7 @@ import { import type { ContractRevisionWithRatesType } from './revisionTypes' import { parsePartialHPFD } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto/toDomain' import type { PartialHealthPlanFormData } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto/toDomain' +import { isEqualData } from '../../resolvers/healthPlanPackage/contractAndRates/resolverHelpers' function convertContractWithRatesToUnlockedHPP( contract: ContractType @@ -91,7 +92,7 @@ function convertContractWithRatesToFormData( stateNumber: number ): HealthPlanFormDataType | Error { // additional certifying actuaries are on every rate post refactor but on the package pre-refactor - const pkgAdditionalCertifyingActuaries: Set = new Set() + const pkgAdditionalCertifyingActuaries: ActuaryContact[] = [] let pkgActuaryCommsPref: ActuaryCommunicationType | undefined = undefined const rateInfos: RateInfoType[] = contractRev.rateRevisions.map( @@ -115,7 +116,13 @@ function convertContractWithRatesToFormData( } = rateRev.formData for (const additionalActuary of addtlActuaryContacts) { - pkgAdditionalCertifyingActuaries.add(additionalActuary) + if ( + !pkgAdditionalCertifyingActuaries.find((actuary) => + isEqualData(actuary, additionalActuary) + ) + ) { + pkgAdditionalCertifyingActuaries.push(additionalActuary) + } } // The first time we find a rate that has an actuary comms pref, we use that to set the package's prefs diff --git a/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.test.ts b/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.test.ts index c065a25320..c39c52967d 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.test.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.test.ts @@ -257,6 +257,22 @@ describe.each(flagValueTestParameters)( // update that draft form data. const formData = Object.assign(latestFormData(createdDraft), { + addtlActuaryContacts: [ + { + name: 'additional actuary 1', + titleRole: 'additional actuary title 1', + email: 'additionalactuary1@example.com', + actuarialFirm: 'MERCER' as const, + actuarialFirmOther: '', + }, + { + name: 'additional actuary 2', + titleRole: 'additional actuary title 2', + email: 'additionalactuary1@example.com', + actuarialFirm: 'MERCER' as const, + actuarialFirmOther: '', + }, + ], rateInfos: [rate1, rate2], })