bcgov / gwells

Groundwater Wells and Aquifers application for the Ministry of Environment
https://apps.nrs.gov.bc.ca/gwells/
Apache License 2.0
29 stars 36 forks source link

Bug- Aquifer number reversion on Wells page #2173

Open QSu-2023 opened 6 months ago

QSu-2023 commented 6 months ago

Describe the Bug It seem that the bug in ticket 2108 comes back again. For a well's aquifer number that has been changed from A to B during a bulk change, an editing to this well (include uploading an attachment) will case a reversion (the aquifer number is changed back to A and this change is not showing in the change history) . So far the wells noticed with this reversion are: WTNs 75653, 57967, 40374.

Expected Behaviour The aquifer number of the well should not be changed after an editing on a well.

Actual Behaviour An editing on a well will change the aquifer number of this well to the previous value from bulk upload/change

Steps To Reproduce Steps to reproduce the behaviour: For duplicating this bug, I can recommend WTN 3723, whose aquifer has been changed to 1143 from 662 from a bulk upload. Try to make any editing of this well and save to see if the aquifer will be changed back to 662.

acatchpole commented 6 months ago

This is a result of an error on our part. We recommended that redoing all the bulk updates would fix the issue going forward. Turns out, that wasn't completely true.

WHAT WAS WRONG: we did not take into account the fact that when you do a bulk update, if the aquifer_id is not being changed (old aquifer is the same as the new aquifer) then the update process just skips over those wells. This is a problem because most of the wells did that were affected by this bug had not actually experienced reversion. So when a bulk update was re-run, these wells still had the correct aquifer_id, and did not have the update run on them that fixes the reversion issue.

HOW TO TEST THE FIX: In the staging realm, I have found 2 wells that received the same bulk update before our fix, and so will experience reversion. The staging realm also has the fix implemented. The two wells are WTN 87167 and 96619.

  1. go here to edit 87167. you should see the aquifer_id revert TO 1098 FROM 1143 (bug behaviour). NOTE: this test will only be demonstrative once

  2. go here to run a bulk update using the attached CSV file which will update 87167 and 96619 to aquifer 1143. 1143 is what 96619 is already correlated with and you should see that it is no longer skipped during the update.

  3. go here to edit 96619. You should see NO reversion. Bug fixed! Yay!<I have included step 1 here just to demonstrate the bug can still be seen in this environment, and that running the a new bulk update fixes it>

QSu-2023 commented 6 months ago

Thanks for the work on this fix! Please move forward to prod.