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

[MDS-6205] Permit condition specific reports #3302

Merged
merged 14 commits into from
Nov 14, 2024

Conversation

matbusby-fw
Copy link
Collaborator

Objective

  • Created a mine_report_permit_requirement table to set up permit required reports with frequency that can be attached to a permit condition.
  • Updated front and backend to interface with this new table in the permit conditions view
  • Set up create of a mine_report_permit_requirement flow

MDS-6205

permit-reports

@matbusby-fw matbusby-fw force-pushed the mds-6205-permit-reports branch from 0ca1062 to dea99af Compare November 8, 2024 23:58
@taraepp
Copy link
Collaborator

taraepp commented Nov 12, 2024

I am still a bit unsure if what the condition requirement should be mapped to is the permit or the permit amendment (granted, the permit condition is already mapped to the permit amendment which is mapped to the permit but I get trying to avoid excessively complicated queries). But I also haven't tried running or rendering it. The decider to me would be "What happens when a permit has 2 amendments, and each of them have conditions with different report requirements?" <-- if it can handle that as is, then I'm happy. May just need to have dataMocks be a little more fleshed out with such a scenario.

update PermitConditions.spec.tsx.snap

update conditions to fix propogation issue

update RenderRadioButtons.spec.js.snap

Add report prop to permit condition form and disable button if report exists

This commit introduces a new optional `report` prop to the `AddReportToPermitConditionForm` component, allowing it to use an existing report if available. Additionally, it modifies the permit condition layer to disable the "Add Report" button when a report already exists for the sub-condition, and ensures permits are refetched after adding a new report.

Rename component and update references

Renamed `AddRequestToPermitConditionForm` to `AddReportToPermitConditionForm` to better reflect its purpose. Also updated all references and added a default export for consistency. Added a snapshot test for the form component.

Add report handling to permit conditions

Enhanced permit conditions to include associated reports. Updated the UI to display report-related information and modified relevant constants, styles, and selectors accordingly.

update interfaces to accomodate permit reports

added permit condition specific report form

updated action buttons on specific permit conditions and updated interface to expand and show action buttons when clicking into a condition.

update backend to accomodate new permit condition specific details for mine reports

migrate mine_report table with new permit specific details
Renamed `AddReporttoPermitConditionForm` to `ReportPermitRequirementForm`. Updated the form to use new `mineReportPermitRequirement` structure. Enhanced `MineReportPermitRequirement` model with soft delete and additional fields like `initial_due_date` and `ministry_recipient`.
@matbusby-fw matbusby-fw force-pushed the mds-6205-permit-reports branch from 460bd18 to 30e3f8f Compare November 13, 2024 22:42
@matbusby-fw
Copy link
Collaborator Author

I am still a bit unsure if what the condition requirement should be mapped to is the permit or the permit amendment (granted, the permit condition is already mapped to the permit amendment which is mapped to the permit but I get trying to avoid excessively complicated queries). But I also haven't tried running or rendering it. The decider to me would be "What happens when a permit has 2 amendments, and each of them have conditions with different report requirements?" <-- if it can handle that as is, then I'm happy. May just need to have dataMocks be a little more fleshed out with such a scenario.

It worked since it was just using it to grab the requirements for that permit, and since the important connection was between permit_condition and the requirement it would maintain the correct usage. That said, I think you're right that amendment is actually more appropriate, so I updated it to adhere to that.

@matbusby-fw matbusby-fw marked this pull request as ready for review November 13, 2024 23:13
@matbusby-fw matbusby-fw added the 👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback. label Nov 13, 2024
Added feature flag check to control permit condition editing. Updated PermitConditionLayer component to respect user permissions and feature availability. Simplified getMineReportPermitRequirements selector for clarity.
Removed `ValidationError` and `Raw` imports from `helpers.py` as they were not being used. Added a test case in `test_expected_auth.py` for `MineReportPermitRequirementResource` to ensure proper resource handling and permissions.
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_common'

Failed conditions
34.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link

Quality Gate Passed Quality Gate passed for 'bcgov-sonarcloud_mds_minespace-web'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_core-web'

Failed conditions
1 Security Hotspot
63.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link

@matbusby-fw matbusby-fw requested a review from taraepp November 14, 2024 22:09
@matbusby-fw matbusby-fw merged commit 7670a16 into develop Nov 14, 2024
16 of 18 checks passed
@matbusby-fw matbusby-fw deleted the mds-6205-permit-reports branch November 14, 2024 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants