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

Fix emission allocation bugs identified in UAT #2637

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

acatchpole
Copy link
Contributor

@acatchpole acatchpole commented Dec 20, 2024

card: bcgov/cas-reporting#468

Issues Resolved:

Bug 1: Unable to submit when all emissions have been 100% allocated

The problem: This bug was due to a precision issue. During testing, a user had all emissions showing as 100% allocated, but was prevented from saving by a validation error indicating an incorrect allocation. In fact, the validation was working as intended. There was an over-allocation of emissions. BUT the amount over was .000049% of the total. And because the percentage display only uses 2-digit precision, it still showed as just 100.00%.

The fix: This problem really only exists for values that are very slightly off 100%. If it is more substantially off, then it would not show 100.00% and the problem allocation would be obvious. So i have added some edge case handling. For values that are >100 and <100.01, display 100.01. And for values <100 and >99.99, display 99.99. This is only for displaying to the users and does not affect allocation amounts or validation. It just makes it more obvious to users where an allocation error is.

image1 <correct allocation to 100.00%>
image

image2 <an over-allocation of ~.000001%>
image

Bug 2: The totals of the totals allocated to products does not equal the total amount of emissions

The problem: Excluded emission allocations were being improperly included in the fields showing the total emissions allocated to a product which led to a double counting of emissions. This error was not present for the overall total emissions value, and so a discrepancy was seen.
The fix: omit excluded emission allocations from the calculation of total emissions allocated to each product.

To Test locally:

see #2553 and
"The easiest way to get some excluded emissions is to use a General Stationary Combustion activity, select a fuel that is classified as 'woody biomass' and choose 'CO2' as the gas type. That emission will be excluded." for instructions on adding reportable and excluded emissions to be allocated

Copy link
Contributor

@dleard dleard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. I like the solution for the ~100% issue!

@acatchpole acatchpole force-pushed the chore/468-more-emission-allocation-bugs branch 3 times, most recently from 5fa9ada to 7364d44 Compare December 31, 2024 18:19
@acatchpole acatchpole force-pushed the chore/468-more-emission-allocation-bugs branch from 7364d44 to 8e95e9f Compare December 31, 2024 18:38
@acatchpole acatchpole merged commit a144866 into develop Dec 31, 2024
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants