-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2057 from bcgov/gwells-2011-attachments-linking
[GWELLS-2011] FEATURE** Create file count in database for searching
- Loading branch information
Showing
15 changed files
with
301 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
MAX_EXPORT_COUNT = 999999 | ||
MAX_LOCATION_COUNT = 999999 | ||
|
||
WELL_TAGS_PUBLIC = [ | ||
{ "text": "Well Construction Report", "value": "Well Construction" }, | ||
{ "text": "Well Alteration Report", "value": "Well Alteration" }, | ||
{ "text": "Well Decommission Report", "value": "Well Decommission" }, | ||
{ "text": "Pictures/Photos", "value": "Photo" }, | ||
{ "text": "Well Pump Installation Report", "value": "Well Pump Installation" }, | ||
{ "text": "Pumping Test Report", "value": "Pumping Test" }, | ||
{ "text": "Map(s)", "value": "Map" }, | ||
{ "text": "Other", "value": "Additional Well Details" }, | ||
] | ||
|
||
|
||
WELL_TAGS_PRIVATE = [ | ||
{ "text": "Well Inspection Report", "value": "Well Inspection" }, | ||
{ "text": "Confirmation/Alternative Specifications", "value": "Alternative Specs" }, | ||
{ "text": "Water Quality Report", "value": "Water Quality" }, | ||
{ "text": "Health Authority Report", "value": "Health Authority" }, | ||
{ "text": "Consultant's Report", "value": "Consultants Report" }, | ||
] | ||
|
||
WELL_TAGS = [] | ||
WELL_TAGS.extend(WELL_TAGS_PUBLIC.copy()) | ||
WELL_TAGS.extend(WELL_TAGS_PRIVATE.copy()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 2.2.28 on 2023-11-09 21:45 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wells', '0141_add_drinking_water_protection_area_ind'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='WellAttachment', | ||
fields=[ | ||
('well_construction', models.PositiveSmallIntegerField(default=0)), | ||
('well_alteration', models.PositiveSmallIntegerField(default=0)), | ||
('well_decommission', models.PositiveSmallIntegerField(default=0)), | ||
('photo', models.PositiveSmallIntegerField(default=0)), | ||
('well_pump_installation', models.PositiveSmallIntegerField(default=0)), | ||
('pumping_test', models.PositiveSmallIntegerField(default=0)), | ||
('map', models.PositiveSmallIntegerField(default=0)), | ||
('additional_well_details', models.PositiveSmallIntegerField(default=0)), | ||
('well_inspection', models.PositiveSmallIntegerField(default=0)), | ||
('alternative_specs', models.PositiveSmallIntegerField(default=0)), | ||
('water_quality', models.PositiveSmallIntegerField(default=0)), | ||
('health_authority', models.PositiveSmallIntegerField(default=0)), | ||
('consultants_report', models.PositiveSmallIntegerField(default=0)), | ||
('well_tag_number', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.PROTECT, to='wells.Well')), | ||
], | ||
options={ | ||
'db_table': 'well_attachment_count', | ||
}, | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
app/backend/wells/migrations/0143_attach_attachments_to_wells.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django.db import migrations, models | ||
|
||
def populate_wells_with_attachment_table(apps, schema_editor): | ||
A = apps.get_model('wells', 'Well') | ||
B = apps.get_model('wells', 'WellAttachment') | ||
|
||
for a_instance in A.objects.all(): | ||
if B.objects.filter(well_tag_number=a_instance): | ||
pass # This entry already has a well attachment associated with it | ||
else: | ||
B.objects.create(well_tag_number=a_instance) | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wells', '0142_auto_20231109_2145'), | ||
] | ||
operations = [ | ||
migrations.RunPython(populate_wells_with_attachment_table), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.