-
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-7296 : Create/Edit Sales Details (Disposition) #3731
Conversation
eddherrera
commented
Jan 19, 2024
# Conflicts: # source/backend/api/Areas/Disposition/Controllers/DispositionFileController.cs # source/backend/api/Services/DispositionFileService.cs # source/backend/api/Services/IDispositionFileService.cs # source/backend/dal/Repositories/DispositionFileRepository.cs # source/backend/dal/Repositories/Interfaces/IDispositionFileRepository.cs # source/frontend/src/components/common/form/FastDateYearPicker.tsx # source/frontend/src/features/mapSideBar/disposition/router/DispositionRouter.tsx # source/frontend/src/features/mapSideBar/disposition/tabs/offersAndSale/OffersAndSaleContainerView.tsx
✅ No secrets were detected in the code. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #3731 +/- ##
==========================================
+ Coverage 75.02% 75.21% +0.18%
==========================================
Files 1441 1447 +6
Lines 37194 37498 +304
Branches 6977 7060 +83
==========================================
+ Hits 27905 28204 +299
- Misses 9011 9014 +3
- Partials 278 280 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
✅ No secrets were detected in the code. |
|
||
return new JsonResult(_mapper.Map<DispositionFileSaleModel>(updatedSale)); | ||
} | ||
|
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.
Adding unit tests for controllers is pretty quick, can you please add the minimal amount to allow for test coverage?
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.
updated
|
||
/// <summary> | ||
/// get/set - A list of disposition Sale Purchaser(s) Solicitors. | ||
/// get/set - Disposition Sale Purchaser(s)'s Solicitor. |
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.
Purchaser(s)'s?
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.
updated
@@ -47,22 +75,34 @@ export class DispositionSaleFormModel { | |||
finalConditionRemovalDate: emptyStringtoNullable(this.finalConditionRemovalDate), | |||
saleCompletionDate: emptyStringtoNullable(this.saleCompletionDate), | |||
saleFiscalYear: emptyStringtoNullable(this.saleFiscalYear), | |||
finalSaleAmount: this.finalSaleAmount, | |||
realtorCommissionAmount: this.realtorCommissionAmount, | |||
finalSaleAmount: this.finalSaleAmount ? parseFloat(this.finalSaleAmount.toString()) : null, |
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.
why is this necessary?
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.
When a value it's removed from the Input, it's being passed as an Empty String, (although it should have been parsed as a null, it doesn't, so a check is needed.)
} | ||
|
||
static fromApi(entity: Api_DispositionFileSale) { | ||
const model = new DispositionSaleFormModel(entity.id, entity.dispositionFileId); | ||
static fromApi(entity: Api_DispositionFileSale): DispositionSaleFormModel { |
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.
This is a pretty complex model, it looks like a good candidate for model unit tests. See some of our other model unit tests for example (they are quite simple).
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.
updated
const netBookAmount = getIn(values, 'netBookAmount'); | ||
const sppAmount = getIn(values, 'sppAmount'); | ||
|
||
useEffect(() => { |
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.
This code is a bit odd, why is being touched a requirement to display the summed totals? wouldn't the user want to see the totals regardless of whether every field has been touched?
I think this should be changed. If I come back to edit a sale, I wouldn't expect to have to touch every field in order to see my new total. What if I just want to change one field?
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.
the amounts are update when any of the fields are touched. not when all are touched.
/* eslint-disable no-template-curly-in-string */ | ||
import * as yup from 'yup'; | ||
|
||
export const DispositionSaleFormYupSchema = yup.object().shape({ |
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.
these are all strings, but in actuality a lot of these values are numbers or dates, please fix.
Make sure to enforce number size limits.
Also, it probably makes sense to limit the fiscal year to 4 digits.
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.
updated
<> | ||
{values.dispositionPurchasers.map( | ||
(purchaser: DispositionSaleContactModel, index: number) => ( | ||
<React.Fragment key={`purchaser-${index}`}> |
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.
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.
updated
const taxCollectedAmountValue = getIn(formikProps.values, 'gstCollectedAmount'); | ||
|
||
if (!isGstRequired) { | ||
setModalContent({ |
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.
this looks like it isn't covered in tests, but is one of the more complex workflows in this logic, probably should be covered.
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.
updated
sppTouched) && | ||
!isSubmitting | ||
) { | ||
if (gstDecimal && isGstEligible) { |
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.
this may not be safe, as if gstDecimal is 0 all of this logic will be skipped.
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.
updated
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.
see comments.
✅ No secrets were detected in the code. |
@@ -38,6 +52,20 @@ export class DispositionSaleFormModel { | |||
|
|||
model.netProceedsBeforeSppAmount = calculateNetProceedsBeforeSppAmount(entity); | |||
model.netProceedsAfterSppAmount = calculateNetProceedsAfterSppAmount(entity); | |||
|
|||
model.dispositionPurchasers = entity.dispositionPurchasers?.map( |
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.
not sure why this is not barking, but the result of this could be an undefined, that does not match the type in the model
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.
Updated
}} | ||
/> | ||
</SectionField> | ||
<SectionField label=" Realtor commission ($)" labelWidth="5" contentWidth="5"> |
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.
nit space on the label
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.
Updated
|
||
model.dispositionPurchaserAgent = entity.dispositionPurchaserAgent | ||
? DispositionSaleContactModel.fromApi(entity.dispositionPurchaserAgent) | ||
: new DispositionSaleContactModel(null, entity.id, 0, null); |
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.
this constructor is being called with the same hardcoded parameters, that look like a codesmell. instead how about using a static method that builds the object using only the entity id?
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.
I would rather just simplify the constructor instead of adding another method.
const purchaserContact = new DispositionSaleContactModel( | ||
null, | ||
dispositionSaleId, | ||
0, | ||
null, | ||
); | ||
arrayHelpers.push(purchaserContact); |
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.
dame here
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.
Updated
onSubmit={async (values: DispositionSaleFormModel, formikHelpers) => { | ||
try { | ||
const sale = await onSave(values.toApi()); | ||
if (sale && sale.id) { |
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.
note that the sale id could be zero
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.
that's ok, when Zero it would mean the Api request call wasn't successful.
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.
under that logic it should check for a zero as well
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.
updated
const StyledFormWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
text-align: left; | ||
height: 100%; | ||
overflow-y: auto; | ||
padding-bottom: 1rem; | ||
`; | ||
|
||
const StyledContent = styled.div` | ||
background-color: ${props => props.theme.css.filterBackgroundColor}; | ||
`; | ||
|
||
const StyledFooter = styled.div` | ||
margin-right: 1rem; | ||
padding-bottom: 1rem; | ||
z-index: 0; | ||
`; |
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.
any chance this is duplicated?
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.
Very likely, we could create a story to define a new css definition for these kind of components.
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.
based on comments
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
@@ -246,6 +246,34 @@ public PimsDispositionSale GetDispositionFileSale(long dispositionFileId) | |||
return _dispositionFileRepository.GetDispositionFileSale(dispositionFileId); | |||
} | |||
|
|||
public PimsDispositionSale UpdateDispositionFileSale(long dispositionFileId, long saleId, PimsDispositionSale dispositionSale) |
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.
saleId and dispositionfileid are no longer necessary
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.
Updated
return updatedSale; | ||
} | ||
|
||
public PimsDispositionSale AddDispositionFileSale(long dispositionFileId, PimsDispositionSale dispositionSale) |
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.
does the dispositionsale have an invalid dispositionfileId? otherwise the file id does not need to be passed separately into the service
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.
Updated
✅ No secrets were detected in the code. |
* Refactoring of modals and changes on Smoke Test Automation Test Cases * Automation refactoring - modals, updating fields on Compensation, Digital Docs for Property Management * Refactoring modals * Automation refactoring - modals, updating fields on Compensation, Digital Docs for Property Management * Refactoring modals * Automation updates * Automation updates * Contacts elements update * Digital Documents subtitles fix * CI: Bump version to v5.0.0-71.25 * Version bump (#3729) * CI: Bump version to v5.0.0-72.1 * Disposition Files initial Automation * CI: Bump version to v5.0.0-72.2 * Psp 7611 - ensure undefined/null handled correctly by contact parsers. (#3730) * handle null and undefined contact fields. * remove debugger; * CI: Bump version to v5.0.0-72.3 * PSP-7578 Remove Project and Product from Header of Disposition File (#3734) * Fix runtime error when user guid is invalid * Remove Project and Product from Header of Disposition File * Test corrections * CI: Bump version to v5.0.0-72.4 * psp-7630 ensure that properties added directly to inventory have the … (#3728) * psp-7630 ensure that properties added directly to inventory have the correct flags set. * test correction. Signed-off-by: devinleighsmith <[email protected]> --------- Signed-off-by: devinleighsmith <[email protected]> * CI: Bump version to v5.0.0-72.5 * psp-7609 ensure that changing the status of an acq file generates a note. (#3726) * CI: Bump version to v5.0.0-72.6 * lint correction. (#3733) * CI: Bump version to v5.0.0-72.7 * IS-72.00 Database Schema (#3716) * IS-72.00 Database Schema PSP_PIMS S72.00 Sprint 72 2024-Jan-16 - Altered tables: - PIMS_PROPERTY - PIMS_PROPERTY_HIST - Altered build scripts: - 002_PSP_PIMS_Build.sql - 020_DML_PIMS_STATIC_VARIABLE.sql - 148_DML_PIMS_DSP_CHKLST_ITEM_TYPE.sql - Added test scripts: - 071_PIMS_PROPERTY_CONTACT.sql - Altered test scripts: - 005_DML_LEASE_PROPERTY.sql - Requires additional metadata to meet standards * fixed build not matching alter up result * aligned latest folder --------- Co-authored-by: Manuel Rodriguez <[email protected]> * CI: Bump version to v5.0.0-72.8 * generated scaffold and removed lingering files (#3738) * CI: Bump version to v5.0.0-72.9 * Disposition checklist automation * fixed the disposition bug 7582 * CI: Bump version to v5.0.0-72.10 * Added Reordering of the DISPLAY_ORDER Columns (#3742) Reordered the display order following the insertion/deletion of the PIMS_DSP_CHKLST_ITEM_TYPE table. * CI: Bump version to v5.0.0-72.11 * PSP-7296 : Create/Edit Sales Details (Disposition) (#3731) * CI: Bump version to v5.0.0-72.12 * PSP-7639 PIMS HIST Table fix commit (#3743) Fix on missing Historical rows that were identified on 3 tables in UAT database 1.PIMS_INSURANCE 2.PIMS_LEASE_TENANT 3.PIMS_PROPERTY_LEASE * CI: Bump version to v5.0.0-72.13 * PSP-7509 : Allow Contractor to Create or Edit Disposition File (#3735) Co-authored-by: Eduardo Herrera <[email protected]> * CI: Bump version to v5.0.0-72.14 * Disposition File details, documents and notes. Refactoring on File Properties * PSP-7510 : Disallow Contractor to Remove Themself from Disposition File (#3745) Co-authored-by: Eduardo Herrera <[email protected]> * CI: Bump version to v5.0.0-72.15 * correct disposition list view file number. (#3736) * CI: Bump version to v5.0.0-72.16 * Offers and sales tab automation * disposition offers and sales tab * Psp 7614, 7657, 7626, 7610 assorted text corrections. (#3737) * text corrections. * correct title text. * psp-7657 fix modal buttons. * test updates. * lint fixes. * CI: Bump version to v5.0.0-72.17 * CI: Bump version to v5.0.0-72.18 * Refactoring and Disposition file automation * Merge conflicts between local and remote * Disposition files - Offers and sale create and update * Deleting AcquisitionProperties class, replaced by SharedFileProperties * Text changes (#3752) * CI: Bump version to v5.0.0-72.19 * correct message text. (#3749) * CI: Bump version to v5.0.0-72.20 * Refactoring LeaseTenants class * CI: Bump version to v5.0.0-72.21 * PSP-6668 FT: Acquisition File: Compensation: Show error modal instead of toast when total allowable compensation value is less than total compensation value (#3755) * Show modal popup with warning message for total allowable compensation * Test corrections * CI: Bump version to v5.0.0-72.22 * PSP-7664 FT-REG: When cancelling, the confirmation modal should be consistent around different types of files (#3747) * Increase the default width of modals * Rename file * Refactor duplicate code * Verbiage update * Update snapshots * Text updates * Test corrections * CI: Bump version to v5.0.0-72.23 * psp-7680 add agreement status type to agreement export. (#3751) * add agreement status type to agreement export. * test corrections. * CI: Bump version to v5.0.0-72.24 * Pipeline updates (#3756) * add keycloak sync to all pipelines. add uat hotfix and pre-release hotfix pipelines. update builds/keycloak sync to support new configuration. * correct uat secret name * add prod secrets for keycloak sync * correct typo. * CI: Bump version to v5.0.0-72.25 --------- Signed-off-by: devinleighsmith <[email protected]> Co-authored-by: Sue Tairaku <[email protected]> Co-authored-by: Sue Tairaku <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: praveen <[email protected]> Co-authored-by: devinleighsmith <[email protected]> Co-authored-by: Doug Filteau <[email protected]> Co-authored-by: Manuel Rodriguez <[email protected]> Co-authored-by: pravkuma14 <[email protected]> Co-authored-by: Eduardo <[email protected]> Co-authored-by: ap-quartech <[email protected]> Co-authored-by: Eduardo Herrera <[email protected]>