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

chore: 405 - refactor report needs verification logic as service #2625

Merged
merged 8 commits into from
Jan 6, 2025

Conversation

shon-button
Copy link
Contributor

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

Addresses review comments from @pbastia in PR: chore: conditional verification routing

refactor (conditional) logic...under a service
(to be used by 450; 453)

Addresses 453
Addresses 450

🚀 Impact:

  • Implements report "needs verification" logic as an API service for use in Compliance Summary page routing, Attachment page required field, and Sign-Off page verification statement validation on Submit Report

🔬 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

Test Registration Purpose = "OBPS Regulated Operation"

  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
    Expected Results
  • Review operation information page displays
  • Field Registration Purpose = "OBPS Regulated Operation"
    image
  1. Complete the report pages until http://localhost:3000/reporting/reports/3/compliance-summary
    Expected Results
  • Compliance Summary page displays
  • Page has button Continue
    image
  1. Click button Continue
    Expected Results
  • Verification page displays because Operation 3/Registration Purpose = "OBPS Regulated Operation"
    image
  1. Navigate to localhost:3000/reporting/reports/3/attachments
  2. Click button Save & Continue
    Expected Results
  • Verification Statement file is mandatory
    image
  1. Navigate to http://localhost:3000/reporting/reports/3/sign-off
  2. Complete form and lick button Submit Report
    Expected Results
  • Snackbox displays error message A verification statement must be uploaded with this report. Please upload a verification statement on the Attachments page.
    image

Test Registration Purpose = "Electricity Import Operation"

  1. Navigate to http://localhost:3000/reporting/reports
  2. On row Operation 14, click button Start
    Expected Results
  • Review operation information page displays
  • Field Registration Purpose = "Electricity Import Operation"
  1. Complete the report pages so that total emissions attributable < 25,000 TCo2
  2. From http://localhost:3000/reporting/reports/4/compliance-summary click button Continue
    Expected Results
  • Final Review page displays because Operation 14/Registration Purpose != ("OBPS Regulated Operation":"Opt-in"; "New Entrant") AND total emissions attributable < 25,000 TCo2
    image
  1. Navigate to localhost:3000/reporting/reports/3/attachments
  2. Click button Save & Continue
    Expected Results
  • Verification Statement file is NOT mandatory
    image
  1. Navigate to http://localhost:3000/reporting/reports/4/sign-off
  2. Complete form and lick button Submit Report
    Expected Results
  • Snackbox DOES NOT displays error message A verification statement must be uploaded with this report. Please upload a verification statement on the Attachments page.
  • Report is submitted
    image

Optional: Test Registration Purpose = "Electricity Import Operation" total emissions attributable >=25,000 TCo2

  1. Navigate to http://localhost:3000/reporting/reports
  2. On row Operation 14, click button Start
  3. Complete the report pages so total emissions attributable >=25,000 TCo2
  4. From http://localhost:3000/reporting/reports/4/compliance-summary click button Continue
    Expected Results
  • Verification page displays because Operation 14/ total emissions attributable >=25,000 TCo2
    image
  1. Navigate to localhost:3000/reporting/reports/4/attachments
  2. Click button Save & Continue
    Expected Results
  • Verification Statement file is mandatory
    image
  1. Navigate to http://localhost:3000/reporting/reports/4/sign-off
  2. Complete form and lick button Submit Report
    Expected Results
  • Snackbox displays error message A verification statement must be uploaded with this report. Please upload a verification statement on the Attachments page.
    image

@shon-button shon-button force-pushed the chore/405-report-needs-verification-api branch 2 times, most recently from a0864aa to 44c10ca Compare December 19, 2024 16:28
@shon-button shon-button changed the title 405 - refactor report needs verification api chore: 405 - refactor report needs verification api Dec 19, 2024
@shon-button shon-button force-pushed the chore/405-report-needs-verification-api branch 3 times, most recently from 62e5b17 to 4768e0f Compare December 19, 2024 20:41
@shon-button shon-button changed the title chore: 405 - refactor report needs verification api chore: 405 - refactor report needs verification logic as service Dec 19, 2024
@shon-button shon-button force-pushed the chore/405-report-needs-verification-api branch 4 times, most recently from 22dd9c6 to 40f409a Compare December 19, 2024 21:58
@shon-button shon-button force-pushed the chore/405-report-needs-verification-api branch from 40f409a to b53df0e Compare December 20, 2024 17:23
Copy link
Contributor

@pbastia pbastia left a comment

Choose a reason for hiding this comment

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

just a couple of nitpicks, this is excellent!!

bc_obps/reporting/service/report_verification_service.py Outdated Show resolved Hide resolved
bc_obps/reporting/service/report_verification_service.py Outdated Show resolved Hide resolved
Comment on lines 12 to 18
REGULATED_OPERATION_PURPOSES = {
Operation.Purposes.OBPS_REGULATED_OPERATION,
Operation.Purposes.OPTED_IN_OPERATION,
Operation.Purposes.NEW_ENTRANT_OPERATION,
}
ATTRIBUTABLE_EMISSION_THRESHOLD = Decimal('25000000')

Copy link
Contributor

Choose a reason for hiding this comment

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

These should probably live in a utils or config place, it's important that the tests use the same source as the service code for these values

@shon-button shon-button force-pushed the chore/405-report-needs-verification-api branch from fbfc051 to 9f8617d Compare January 6, 2025 15:19
Co-authored-by: Pierre Bastianelli <[email protected]>

chore: implement review suggestions
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