specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
63 stars 36 forks source link

Max Uncertainty Est field won't validate on form #4508

Open bronwyncombs opened 7 months ago

bronwyncombs commented 7 months ago

Describe the bug A clear and concise description of what the bug is.

After adding GEOLocate marker to application, the form is unable to be saved because of the Max Uncertainty Est field, even though it doesn't actually tell you that. On 7.9.3.1, the Save button will turn red momentarily but it dismisses when a value is entered into this field. On edge, nothing you do makes the form happy.

To Reproduce Steps to reproduce the behavior:

  1. Go to new Locality
  2. Add name and geography
  3. Open GEOLocate and place marker
  4. Save to Application
  5. See error on edge

Expected behavior A clear and concise description of what you expected to happen.

Allow to save form

Screenshots If applicable, add screenshots to help explain your problem.

https://github.com/specify/specify7/assets/135047322/13e7aa42-4f00-42a5-8203-cc4a94cdb9b6

melton-jason commented 6 months ago

I was able to recreate this issue all way the back to 7.8.6! The problem is that the uncertainty in GeoLocate is ` (or an empty string), and Specify attempts to parse this as a floating point number which results in the JavaScript primitiveNaN. Specify then tries to set themaxUncertainityEst` to this value, which results in the save blocker.

https://github.com/specify/specify7/blob/9044ffc1e29eea13e1d18ccf20cad10ef5290978/specifyweb/frontend/js_src/lib/components/FormPlugins/GeoLocate.tsx#L70-L73

In this case, I would assume expected behavior would be to either:

  1. Do not set any value into the maxUncertainityEst field
  2. Set the maxUncertainityEst to 0

@specify/ux-testing Which of these solutions would be preferred?

melton-jason commented 6 months ago

Not fixed by #4588

emenslin commented 1 month ago

Can recreate in edge (7.9.6) but now you can just bypass the save by pressing it even though it is red and says the field is invalid

https://github.com/user-attachments/assets/4998a694-8f6e-42eb-b0b7-221fd2039878