Skip to content
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

Merged
merged 7 commits into from
Jul 17, 2024

Conversation

FuriousLlama
Copy link
Collaborator

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

…e payment to a class. Fixed issue with totals not beign calculated.
@FuriousLlama FuriousLlama self-assigned this Jul 16, 2024
@FuriousLlama FuriousLlama added the bug Something isn't working label Jul 16, 2024
@@ -1,274 +1,5 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`PaymentsView component > renders as expected 1`] = `
Copy link
Collaborator Author

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 {
Copy link
Collaborator Author

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

Comment on lines +42 to +45
const variablePaymentData: LeasePeriodByCategoryProjection[] = [
new LeasePeriodByCategoryProjection(period, ApiGen_CodeTypes_LeasePaymentCategoryTypes.BASE),
new LeasePeriodByCategoryProjection(period, ApiGen_CodeTypes_LeasePaymentCategoryTypes.ADDL),
new LeasePeriodByCategoryProjection(period, ApiGen_CodeTypes_LeasePaymentCategoryTypes.VBL),
Copy link
Collaborator Author

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.

Copy link
Contributor

✅ No secrets were detected in the code.

1 similar comment
Copy link
Contributor

✅ 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)
Copy link
Collaborator Author

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.

Copy link
Contributor

✅ No secrets were detected in the code.

Copy link
Contributor

✅ No secrets were detected in the code.

Copy link
Contributor

✅ No secrets were detected in the code.

@asanchezr asanchezr merged commit 1caa33d into bcgov:dev Jul 17, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants