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

289 allocation of emissions bugs #2562

Merged
merged 6 commits into from
Dec 16, 2024
Merged

Conversation

shon-button
Copy link
Contributor

@shon-button shon-button commented Dec 10, 2024

✏️ Notes

🐛 Issues addressed:

Backend:

  • Records are being saved to the report_emission_allocation table in the database when the allocated value is 0.
  • Carry the emission category Ids in the schema & use them in the service
  • (new) Update reporting.models.report_product_emission_allocation\allocated_quantity field max_digits from 10 to 20

Frontend:

  • Carry the emission category Ids in form data as hidden fields (and use them in the payload)
  • The details box when methodology is other is too small & the font is different
  • Field Totals in tCO2e\Total emissions attributable for reporting is of inconsistent width with the rest of the page.
  • (new) Category sections display header emission_category_name

🔬 Local Testing:

  1. From terminal command, start the api server:
cd bc_obps
make reset_db
make run
  1. From terminal command, start the app development server:
cd bciers && yarn dev-all
  1. Navigate to http://localhost:3000
  2. Click button "Log in with Business BCeID"
  3. Navigate to http://localhost:3000/reporting/reports
  4. On row Operation 3, click button Start
  5. Complete the report pages until http://localhost:3000/reporting/reports/3/facilities/f486f2fb-62ed-438d-bb3e-0819b51e3aff/allocation-of-emissions
    Expected results:
  • Allocation of Emissions page displays under step Report Information, task Allocation of Emissions
    image
  • Category product names display as title for each emission allocation section
  • Products emissions reported on form Production Data display as expected in product category Total Emissions
    image
  • Totals in tCO2e\Total emissions attributable for reporting displays total as expected
  • Button Save is enable
  • Button Save and Continue is disabled
  • Message displays All emissions must be allocated to 100% before saving and continuing
    image
  1. Allocate some emissions across category products
    Expected results:
  • Allocation divisions and totlas are reflected as expected in Totals in tCO2e
    image
  1. Complete required fields, click Save
    Expected results:
  • POST request is successful
  • Page does not route to another page
  1. Enter all emission allocations
    Expected results:
  • Button Save and Continue is enabled
  • Message does not display All emissions must be allocated to 100% before saving and continuing
  1. Click Button Save and Continue
    Expected results:
  • POST request is successful and page routes to Additional Reporting Data
    image

@shon-button shon-button force-pushed the bug/289-allocation-of-emissions-bugs branch 9 times, most recently from f2f5bd2 to e4d0d87 Compare December 16, 2024 15:43
@shon-button shon-button force-pushed the bug/289-allocation-of-emissions-bugs branch from eb7d9c1 to b67a8e7 Compare December 16, 2024 16:51
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! This makes things much more smooth & no extraneous data is getting into the database.

One thing I'd check with PO / BA is the behaviour of the "Save" button when 100% of emissions are not yet allocated. There is a message at the bottom that says you cannot "save & continue" without 100% allocation, which is good & that button is greyed out. However, the "Save" button looks live but when clicked, nothing gets saved. If the preference of the PO/BA is to not allow saving data at all until 100% of emissions are allocated then this button should also be greyed out, if they want to be able to save the data as-is at that point, then we'll need to wire that button to actually save when clicked.

^ That can be handled in another ticket when we get clarity on what the expectation is there around saving data when 100% of emissions have not been allocated.
Screenshot:
Screenshot from 2024-12-16 13-35-19

@@ -11,7 +11,7 @@ export default async function FacilityEmissionAllocationPage({
}) {
const orderedActivities = await getOrderedActivities(version_id, facility_id);
const initialData = await getEmissionAllocations(version_id, facility_id);

console.log(initialData);
Copy link
Contributor

Choose a reason for hiding this comment

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

left over debugging line

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, I just went ahead and merged it immediately after approval. My bad. I'll just take this out in my current PR

@dleard dleard merged commit 1e52ceb into develop Dec 16, 2024
42 checks passed
@dleard dleard deleted the bug/289-allocation-of-emissions-bugs branch December 16, 2024 22:08
@shon-button
Copy link
Contributor Author

shon-button commented Dec 16, 2024

Nice work! This makes things much more smooth & no extraneous data is getting into the database.

One thing I'd check with PO / BA is the behaviour of the "Save" button when 100% of emissions are not yet allocated. There is a message at the bottom that says you cannot "save & continue" without 100% allocation, which is good & that button is greyed out. However, the "Save" button looks live but when clicked, nothing gets saved. If the preference of the PO/BA is to not allow saving data at all until 100% of emissions are allocated then this button should also be greyed out, if they want to be able to save the data as-is at that point, then we'll need to wire that button to actually save when clicked.

^ That can be handled in another ticket when we get clarity on what the expectation is there around saving data when 100% of emissions have not been allocated. Screenshot: Screenshot from 2024-12-16 13-35-19

@dleard

For "However, the "Save" button looks live but when clicked, nothing gets saved" did you complete the required field Methodology? If not then Save will trigger the field validation errors; otherwise; the data should save, as it did for me (according to the test steps).

image

@dleard
Copy link
Contributor

dleard commented Dec 16, 2024

Ahh, that might have been it. I do forget to update that field sometimes and jump right into allocating. I'll check it again during our QA session this afternoon, thanks!

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.

3 participants