-
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-8871 | Fixed Period totals not being calculated #4203
Conversation
…e payment to a class. Fixed issue with totals not beign calculated.
@@ -1,274 +1,5 @@ | |||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | |||
|
|||
exports[`PaymentsView component > renders as expected 1`] = ` |
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've compared with Dev and I see no actual difference in the rendering. I will check with Sue once this is merged to confirm that nothing else has changed
@@ -208,8 +208,36 @@ export class FormLeasePayment { | |||
} | |||
} | |||
|
|||
export class FormLeasePeriodWithCategory extends FormLeasePeriod { | |||
category: ApiGen_CodeTypes_LeasePaymentCategoryTypes; | |||
export class LeasePeriodByCategoryProjection { |
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 class now encapsulates the data required to render the Payments by category when variable
const variablePaymentData: LeasePeriodByCategoryProjection[] = [ | ||
new LeasePeriodByCategoryProjection(period, ApiGen_CodeTypes_LeasePaymentCategoryTypes.BASE), | ||
new LeasePeriodByCategoryProjection(period, ApiGen_CodeTypes_LeasePaymentCategoryTypes.ADDL), | ||
new LeasePeriodByCategoryProjection(period, ApiGen_CodeTypes_LeasePaymentCategoryTypes.VBL), |
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.
Logic moved to the constructor of the class.
✅ No secrets were detected in the code. |
1 similar comment
✅ No secrets were detected in the code. |
function renderActualTotal({ row: { original } }: CellProps<FormLeasePeriodWithCategory, string>) { | ||
const total = formatMoney( | ||
(original.payments ?? []) | ||
.filter(p => p.leasePaymentCategoryTypeCode?.id === original.category) |
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 where the actual bug was. This function was used for calculating the totals for the top table (period) and the category split. Because the top table did not have a category it did not add any of the payments.
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
Note: Most of the changes correspond to moving sections of code to different files. I've flagged the relevant pieces of code that are new