Skip to content

Commit

Permalink
Merge branch '10179-co-display-bug' of https://github.com/flexion/ef-cms
Browse files Browse the repository at this point in the history
 into 10179-test-refactor
  • Loading branch information
TomElliottFlexion committed Dec 19, 2023
2 parents 070fb33 + 04bbe93 commit abc5702
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions shared/src/business/entities/cases/Case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,7 @@ export const userIsDirectlyAssociated = function ({ aCase, userId }) {
*/
export const setAdditionalNameOnPetitioners = function ({ obj, rawCase }) {
const contactPrimary = getContactPrimary(rawCase);
const contactSecondary = getContactSecondary(rawCase);

if (contactPrimary && !contactPrimary.additionalName) {
const contactPrimaryRef = obj.petitioners.find(
Expand Down Expand Up @@ -2227,6 +2228,18 @@ export const setAdditionalNameOnPetitioners = function ({ obj, rawCase }) {
break;
}
}

if (contactSecondary && !contactSecondary.additionalName) {
const contactSecondaryRef = obj.petitioners.find(
p => p.contactId === contactSecondary.contactId,
);

switch (rawCase.partyType) {
case PARTY_TYPES.petitionerDeceasedSpouse:
contactSecondaryRef.additionalName = `c/o ${contactSecondaryRef.inCareOf}`;
delete contactSecondaryRef.inCareOf;
}
}
};

/**
Expand Down

0 comments on commit abc5702

Please sign in to comment.