Skip to content

Commit

Permalink
changed so legal_pid saves without dashes even when entered with dashes
Browse files Browse the repository at this point in the history
  • Loading branch information
lunamoonmoon committed Jul 10, 2024
1 parent 866aedd commit d2336b4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
3 changes: 3 additions & 0 deletions app/backend/wells/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,9 @@ def save(self, *args, **kwargs):
if not self.create_date:
self.create_date = timezone.now()

if self.legal_pid:
self.legal_pid = self.legal_pid.replace('-', '')

return super().save(*args, **kwargs)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
<p class="font-weight-bold">3) Parcel Identifier (PID)</p>
<form-input
id="legalPID"
type="number"
type="text"
hint="*Input a 9 digit number (including leading zeroes, if necessary)"
v-model="legalPIDInput"
:errors="errors['legal_pid']"
Expand Down
38 changes: 21 additions & 17 deletions app/frontend/src/submissions/views/SubmissionsHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ export default {
data.well = data.well.well_tag_number
}
if (data.legal_pid) {
data.legal_pid = data.legal_pid.replace(/-/g, '');
}
if (!this.isStaffEdit) {
let skipKeys = []
// we need both ground elevation and its method to be sent for validation on submission
Expand Down Expand Up @@ -322,7 +326,7 @@ export default {
if (window.location.href.indexOf('localhost:8080') > -1 ||
window.location.href.indexOf('gwells-dev-pr') > -1 ||
window.location.href.indexOf('gwells-staging') > -1
) {
) {
testEnv = true
}
Expand Down Expand Up @@ -587,7 +591,7 @@ export default {
},
groundwaterProtectionRegulationValidation(errors) {
const {
owner_full_name,
owner_full_name,
owner_mailing_address,
owner_city,
owner_province_state,
Expand All @@ -614,15 +618,15 @@ export default {
}
},
validateWellIdentificationPlateFields(errors) {
const {
const {
well_class,
identification_plate_number,
well_identification_plate_attached,
} = this.form
const validateWellClasses = [WELL_CLASS.WATER_SUPPLY, WELL_CLASS.INJECTION, WELL_CLASS.RECHARGE]
const isWellIdentificationPlateToBeVerified = validateWellClasses.includes(well_class)
if (isWellIdentificationPlateToBeVerified == false) { return; }
if (!identification_plate_number) {
Expand All @@ -633,11 +637,11 @@ export default {
}
},
validateWellFields(errors) {
const {
work_start_date,
work_end_date,
drilling_methods,
total_depth_drilled,
const {
work_start_date,
work_end_date,
drilling_methods,
total_depth_drilled,
finished_well_depth
} = this.form;
Expand All @@ -650,19 +654,19 @@ export default {
if (drilling_methods.length === 0) {
errors.drilling_methods = ['Drilling Methods Required.'];
}
if (!total_depth_drilled) {
errors.total_depth_drilled = ['Total Depth Drilled Required.'];
if (!total_depth_drilled) {
errors.total_depth_drilled = ['Total Depth Drilled Required.'];
}
if (!finished_well_depth) {
errors.finished_well_depth = ['Finished Well Depth Required.'];
if (!finished_well_depth) {
errors.finished_well_depth = ['Finished Well Depth Required.'];
}
},
newlyConstructedWellValidation(errors) {
const {
const {
work_start_date,
work_end_date,
} = this.form
const mandatoryLicensingDate = NEW_WELL_CONSTRUCTION_VALIDATION_DATE;
const workStartDatePastWorkEndDate = ((work_start_date !== '' && work_end_date !== '') && work_start_date > work_end_date);
Expand Down Expand Up @@ -730,14 +734,14 @@ export default {
if (!this.form.latitude){
errors.latitude = ['Valid Latitude Required'];
}
if (!this.form.longitude) {
if (!this.form.longitude) {
errors.longitude = ['Valid Longitude Required']
}
} else if (wellCoordsNotWithinBC) {
errors.position = ['Coordinates not within BC']
}
}
// Always validate well_class and intended_water_use except for ALT or DEC submissions with a
// well_tag_number specified
if (validateWellClassAndIntendedWaterUse) {
Expand Down

0 comments on commit d2336b4

Please sign in to comment.