-
Notifications
You must be signed in to change notification settings - Fork 24
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
psp-8905 | Contact summary model standarization #4394
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ export const AddLeaseStakeholderContainer: React.FunctionComponent< | |
const [handleSubmit, setHandleSubmit] = useState<(() => void) | undefined>(undefined); | ||
|
||
const { getPersonConcept } = useApiContacts(); | ||
const { execute } = useApiRequestWrapper({ | ||
const { execute: executeGetPerson } = useApiRequestWrapper({ | ||
requestFunction: getPersonConcept, | ||
requestName: 'get person by id', | ||
}); | ||
|
@@ -114,7 +114,7 @@ export const AddLeaseStakeholderContainer: React.FunctionComponent< | |
); | ||
|
||
// fetch any person ids that we do not have person information for. | ||
const personQueries = unprocessedPersons.map(person => execute(person.personId)); | ||
const personQueries = unprocessedPersons.map(person => executeGetPerson(person.personId)); | ||
const personResponses = await Promise.all(personQueries); | ||
const allPersons = personResponses.concat(processedPersons); | ||
|
||
|
@@ -127,14 +127,13 @@ export const AddLeaseStakeholderContainer: React.FunctionComponent< | |
op.person = matchingPerson; | ||
} | ||
}); | ||
stakeholder.stakeholderType = stakeholder?.stakeholderType | ||
? stakeholder.stakeholderType | ||
: isPayableLease | ||
? 'OWNER' | ||
: 'TEN'; | ||
return stakeholder; | ||
}) ?? []; | ||
const formTenants = tenantsWithPersons?.map(t => new FormStakeholder(undefined, t)) ?? []; | ||
const stakeholderType = isPayableLease ? 'OWNER' : 'TEN'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this may cause issues if a user has owners/tenants and then swaps the lease from payable to not-payable. Just a note - let's be careful about the scope of these "refactors" - if we don't have existing tests, and the refactor doesn't include tests to validate the before/after functionality, than these are code changes and not refactors, since we are altering functionality. That is potentially fine - but we need to make sure that the FT team is aware of the scope of these changes - otherwise when this is merged the FT team will not know what to re-test. (this story is psp-8905, which talks about contact summary model changes, I don't think it would be obvious to the FT team that lease stakeholder functionality would be affected). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that refactors should be minimal. In this case, the refactor exposed an improper use of a common model for something that is quite specific (the lease tenants). In an ideal world, the code would have been separated making the changes here much smaller. Fixing this is part of maintaining the code base and cleaning shortcuts that where taken at the time (tech debt). Also, all code changes introduce some risk into the application, and no changes make the application harder to enhance in the future, so there is always a tradeoff. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough, the point remains about the testing team, please make sure the scope of the changes included in this story are clear. |
||
const formTenants = | ||
tenantsWithPersons?.map( | ||
t => new FormStakeholder(undefined, { contact: t, stakeholderType }), | ||
) ?? []; | ||
setStakeholders([...formTenants, ...matchingExistingTenants]); | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the test may be failing your new isPersonSummary test and returning an empty string. Can you please fix the test model so that it is not ignored (and potentially add an invalid model for testing that does return an empty result).