BiologicalRecordsCentre / SPRING

Repository for tracking issues for the SPRING (EU Pollinator Monitoring) project
GNU General Public License v3.0
0 stars 0 forks source link

Transect form - Data lost if back button used #70

Open andrewvanbreda opened 2 years ago

andrewvanbreda commented 2 years ago

When you hit the button "back" on this part of the website to check the info you filled in about temperature and time etc., all the previously entered info is lost. Would be good to move to different parts of the form without losing things that were already entered.

Investigate options

andrewvanbreda commented 2 years ago

Hi @DavidRoy I have had a look at this one which was sent to you by a user a while ago. This appear to actually be working correctly, apart from in one situation; The change is not saved if the "% Sun" or "% Cloud" fields are completely cleared. I think this fails to save on submission also, not just clicking Back. If you change those fields (not clear), or clear/change other fields, the saving is fine. It is only clearing those two fields that are a problem.

(Note: If you do a combination the same occurs....e.g. if one of those fields is cleared, and another type of change is made at same time, the other change IS saved, but the cleared "% Sun" or "% Cloud" just go back to the way they were)

However I am struggling to work out what should be happening, I believe the problem is related to whether these fields are mandatory. If you clear one of these fields and click off it, a message is displayed "This field is required" (which looking at the code seems to be built into the form, these fields are not set as mandatory in the Warehouse). Even though it says the fields should be filled in, it doesn't stop you leaving the page. So I think this combination results in this problem of that data not saving.

So I suppose my question is simply how this is how should this behave

  1. Should they not be mandatory at all?
  2. Should they be completely mandatory? (so the "% Sun" or "% Cloud" fields would need filling in on every single column before the user can leave the page
  3. Or do we make them mandatory under certain conditions. (So for instance, they might only become mandatory once a species has been filled in on the column)

I wanted to check this on EBMS. I tried to go to the site but I think the setup is a bit different (creating a Transect still left the "My transect sites" page grid empty). I suspect the behaviour would be similar if I could get to the data entry point.

DavidRoy commented 2 years ago

Thanks for looking into this. The fields are mandatory, so please adjust the form/warehouse settings as required

andrewvanbreda commented 1 year ago

Hi @DavidRoy I have revisited this issue. However after retesting, the save appears to be working now. I cannot think of a specific fix that would have resulted in this, but may have come about from improvements to the elegance of the code as a result of a couple of issues.

However I have noticed one subtle change that has passed me by until now, and now I am not sure if it is right.

When the Butterfly & Bee/Hoverfly mode was added to the form, I think the system started also adding the Sun % and Cloud % fields to the Bee/Hoverfly tab (not just butterfly tab)

I am not sure if this is correct? I suspect the EBMS code this form is based on is adding those attributes automatically to the first tab it finds. If this is incorrect can you let me know and reassign issue to me. If it is correct, can you close (if you are happy with my conclusion the saving is ok now)