UCHIC / ODM2Sensor

A Python-Django web application for water-related sensor infrastructure and data management.
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Error when editing action #237

Open AmberSJones opened 6 years ago

AmberSJones commented 6 years ago

I add a calibration action to an existing site visit. Seems fine. I then click “Edit Calibration Description”. I make an edit and click save. I get this error. When I access the site visit, the edit does actually proceed, however.

image

Elijahwalkerwest commented 6 years ago

Fixed alongside #238

Need to merge and deploy.

Elijahwalkerwest commented 6 years ago

Deployed and ready for testing.

AmberSJones commented 6 years ago

Still getting an error when I attempt to do this. In this case, the error came when adding the calibration action. When I later view the Site Visit details page, the calibration has been added. This could be related to calibration standards because the calibration standards that I entered did not show up as reference material. http://django.uwrl.usu.edu/equipment/actions/edit-site-visit/1042/ image

Elijahwalkerwest commented 6 years ago

Should be fixed on sandbox now!

AmberSJones commented 6 years ago

Ok, this appears to be functional now, but I think we have some artifacts where existing actions were left with some sort of issue. See below for trying to edit this site visit and the corresponding calibration. But I created a new calibration on this site visit and it worked great. http://django.uwrl.usu.edu/equipment/actions/edit-site-visit/1042/ image

http://django.uwrl.usu.edu/equipment/actions/create-action/InstrumentCalibration/1047/ image

Elijahwalkerwest commented 6 years ago

Looking in to this and there is a lot of strange behavior. I can't find anything creating these anymore, but it looks like actions being deleted without their related actions being deleted. So the Site Visit tried to check its related actions and fails. I'll work on a script for this.

Elijahwalkerwest commented 6 years ago

However this is now a different issue, we should create a new issue and close this one.

Elijahwalkerwest commented 6 years ago

Sc-sc-scratch that.

It looks like some calibrations were created as Action objects, but not CalibrationActions

So when it tries to explicitly query the related action via the CalibrationAction table, it can't find it.

Elijahwalkerwest commented 6 years ago

Yeah, I added some stuff to action deletion to make sure it doesn't happen again. It looks like this data is bad, i.e. you were trying to edit an action with an ID of 1047, that while there was a valid Action object, there was no CalibrationAction.

This is something Juan's script fixed, or should have fixed. EIther it didn't fix it in the first place, or there is something breaking it. Looking in to it now.

Elijahwalkerwest commented 6 years ago

Looking at the fix_data script it looks like this corner case was missed. Updating it now.

AmberSJones commented 6 years ago

What is the status of this issue? Is there anything still outstanding?

Elijahwalkerwest commented 6 years ago

Let's keep it open. The behavior that caused the broken data is no longer present, but some of the bad data still exists and will do so until we run the script with my updates and clean it up. So either we can close this and make a new issue to that effect, or leave this one open.