diff --git a/app/backend/wells/management/commands/update_analysis_method_codes.py b/app/backend/wells/management/commands/update_analysis_method_codes.py new file mode 100644 index 000000000..9c6038917 --- /dev/null +++ b/app/backend/wells/management/commands/update_analysis_method_codes.py @@ -0,0 +1,16 @@ +from django.core.management.base import BaseCommand +from wells.models import AnalysisMethodCode +from collections import defaultdict +import json + +class Command(BaseCommand): + help = "Update values in the analysis_method_code table" + def update_analysis_method_codes(self): + analysis_method_codes = open("wells/migrations/analysis_method_codes.json") + analysis_codes = json.load(analysis_method_codes) + for entry in analysis_codes: + AnalysisMethodCode.objects.update_or_create(pk=entry["pk"], defaults=entry["fields"]) + + def handle(self, *args, **options): + self.update_analysis_method_codes() + print("update_analysis_method_codes.py completed successfully") diff --git a/app/backend/wells/management/commands/update_codes.py b/app/backend/wells/management/commands/update_codes.py new file mode 100644 index 000000000..bca995185 --- /dev/null +++ b/app/backend/wells/management/commands/update_codes.py @@ -0,0 +1,19 @@ +from django.core.management import call_command +from django.core.management.base import BaseCommand +import os, fnmatch + +class Command(BaseCommand): + file_pattern = 'update_*_codes.py' + folder_path = './wells/management/commands' + help = f'Run all commands using the {file_pattern} format' + + + def handle(self, *args, **options): + matching_files = [] + for file_name in os.listdir(self.folder_path): + if fnmatch.fnmatch(file_name, self.file_pattern): + matching_files.append(file_name) + print(len(matching_files), "files found") + for file_path in matching_files: + call_command(file_path.replace(".py","")) + print("update_codes has completed successfully") diff --git a/app/backend/wells/management/commands/update_pumping_test_description_codes.py b/app/backend/wells/management/commands/update_pumping_test_description_codes.py new file mode 100644 index 000000000..a38f2d692 --- /dev/null +++ b/app/backend/wells/management/commands/update_pumping_test_description_codes.py @@ -0,0 +1,17 @@ +from django.core.management.base import BaseCommand +from wells.models import PumpingTestDescriptionCode +from collections import defaultdict +import json + +class Command(BaseCommand): + help = "Update values in the pumping_test_description_code table" + + def update_pumping_test_description_codes(self): + pumping_test_description_codes = open("wells/migrations/pumping_test_description_codes.json") + pumping_codes = json.load(pumping_test_description_codes) + for entry in pumping_codes: + PumpingTestDescriptionCode.objects.update_or_create(pk=entry["pk"], defaults=entry["fields"]) + + def handle(self, *args, **options): + self.update_pumping_test_description_codes() + print("update_pumping_test_description_codes.py completed successfully") diff --git a/app/backend/wells/migrations/analysis_method_codes.json b/app/backend/wells/migrations/analysis_method_codes.json index ec82c037f..c55d15582 100644 --- a/app/backend/wells/migrations/analysis_method_codes.json +++ b/app/backend/wells/migrations/analysis_method_codes.json @@ -90,10 +90,10 @@ "create_date": "2023-03-31T17:42:52.421Z", "update_user": "DATALOAD_USER", "update_date": "2023-03-31T17:42:52.421Z", - "description": "Other - Please use comments field", + "description": "Other", "display_order": 6, "effective_date": "2013-11-07T05:28:00.402Z", "expiry_date": "9999-12-31T23:59:59Z" } } -] \ No newline at end of file +] diff --git a/app/backend/wells/migrations/pumping_test_description_codes.json b/app/backend/wells/migrations/pumping_test_description_codes.json index ba67087df..fbee9a28b 100644 --- a/app/backend/wells/migrations/pumping_test_description_codes.json +++ b/app/backend/wells/migrations/pumping_test_description_codes.json @@ -20,7 +20,7 @@ "create_date": "2023-03-31T17:42:52.421Z", "update_user": "DATALOAD_USER", "update_date": "2023-03-31T17:42:52.421Z", - "description": "PT - Pumping Well", + "description": "Pumping test - pumping well", "display_order": 1, "effective_date": "2013-11-07T05:28:00.402Z", "expiry_date": "9999-12-31T23:59:59Z" @@ -34,7 +34,7 @@ "create_date": "2023-03-31T17:42:52.421Z", "update_user": "DATALOAD_USER", "update_date": "2023-03-31T17:42:52.421Z", - "description": "PT - Observation Well", + "description": "Pumping test - observation well", "display_order": 2, "effective_date": "2013-11-07T05:28:00.402Z", "expiry_date": "9999-12-31T23:59:59Z" @@ -76,10 +76,10 @@ "create_date": "2023-03-31T17:42:52.421Z", "update_user": "DATALOAD_USER", "update_date": "2023-03-31T17:42:52.421Z", - "description": "Other - Please use comments field", + "description": "Other", "display_order": 5, "effective_date": "2013-11-07T05:28:00.402Z", "expiry_date": "9999-12-31T23:59:59Z" } } -] \ No newline at end of file +] diff --git a/app/frontend/src/wells/views/WellDetail.vue b/app/frontend/src/wells/views/WellDetail.vue index b0401b925..6825cbddc 100644 --- a/app/frontend/src/wells/views/WellDetail.vue +++ b/app/frontend/src/wells/views/WellDetail.vue @@ -502,9 +502,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); - - - + + + @@ -541,7 +541,7 @@ import Documents from '@/wells/components/Documents.vue' import convertCoordinatesMixin from '@/common/convertCoordinatesMixin.js' import ApiService from '@/common/services/ApiService.js' import codeToDescription from '@/common/codeToDescription.js' - +import { FETCH_CODES } from '@/submissions/store/actions.types.js' import { RESET_WELL_DATA } from '@/wells/store/actions.types.js' import { SET_WELL_RECORD, SET_WELL_LICENCE } from '@/wells/store/mutations.types.js' @@ -689,7 +689,7 @@ export default { }, created () { this.fetchSurveys() - + this.$store.dispatch(FETCH_CODES) if (this.id === null) { this.error = `Unable to load well '${this.id}'` } diff --git a/docker-compose.yml b/docker-compose.yml index c935306d5..0efc76cb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -220,7 +220,7 @@ services: ### Volumes ### ############################################################################################# pgadmin: - container_name: pgadmin + container_name: gwells-pgadmin image: dpage/pgadmin4 ports: - 5050:80