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-6118] FE extract permits - DRAFT #3236

Merged
merged 13 commits into from
Sep 18, 2024
Merged

Conversation

simensma-fresh
Copy link
Collaborator

Objective

This is not ready to be reviewed, but for handover purposes (and to get Core API sonarcloud results (https://bcmines.atlassian.net/browse/MDS-0000)

Why are you making this change? Provide a short explanation and/or screenshots

@simensma-fresh simensma-fresh marked this pull request as draft September 5, 2024 20:57
generate_table_migration:
@echo "+\n++ Generating history table migration ...\n+"
@docker compose $(DC_FILE) exec backend bash -c "flask generate_table_migration $(TABLE)"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a little script to auto-generate a CREATE TABLE migration for new tables.
Pretty much the same as the history table creation scripts, just with creating the actual table instead of a _version table

@@ -0,0 +1,203 @@
import { createAppSlice, rejectHandler } from "@mds/common/redux/createAppSlice";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@taraepp Put in actual implementations here for the

  • Fetch Status
  • Delete permit conditions
    actions

@@ -54,6 +53,9 @@ def sub_conditions(self):

@hybrid_property
def step(self):
if self._step:
return self._step
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added in a _step column that contains the step extracted for the permit, and return that if defined instead of the auto-generated step. Note: This will require some work to make work nicely with auto-generation of step when adding / editing conditions

@@ -0,0 +1,162 @@
import uuid
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 file contains pretty much all the logic for mapping between conditions returned from the permit service to the PermitConditions model in Core, including mapping of Category, and building of a nested structure



@celery.task(max_retries=360)
def poll_update_permit_extraction_status(permit_extraction_task_id):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Introduced this celery task to poll for a status update from the permit service. The actual triggering of the permit extraction task through the API happens within the actual POST endpoint

return <LoadingOutlined style={{ fontSize: 120 }} />;
}

return permitExtraction?.task_status === PermitExtractionStatus.in_progress ? (
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 could use some cleanup 😅

dispatch(fetchPermits(id));
}

if (permitExtraction?.task_status === PermitExtractionStatus.in_progress) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Trigger polling for status update when the extraction status job is in progress



assert get_data['records'][0]['mine_document_guid'] in guids
assert get_data['records'][1]['mine_document_guid'] in guids
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hopefully this makes this test a bit less flaky, think the documents are just not returned in any particular order, so sometimes it just fails

Copy link

Quality Gate Passed Quality Gate passed for 'bcgov-sonarcloud_mds_permits'

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 SonarCloud

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 SonarCloud

Copy link

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

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

See analysis details on SonarCloud

Copy link

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

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

See analysis details on SonarCloud

Copy link

Quality Gate Passed Quality Gate passed for 'bcgov-sonarcloud_mds_core-api'

Issues
2 New issues
0 Accepted issues

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

See analysis details on SonarCloud

@taraepp taraepp marked this pull request as ready for review September 18, 2024 17:06
@taraepp taraepp merged commit 4ed5561 into develop Sep 18, 2024
19 of 21 checks passed
@taraepp taraepp deleted the mds-6118-fe-extract-permits branch September 18, 2024 17:11
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