PSU-CSAR / snodas-ui

SNODAS Tools UI
0 stars 1 forks source link

Query Date Range - date textboxes issue #3

Open jdduh opened 2 months ago

jdduh commented 2 months ago

It seems that only the dates picked from the UI's date picker work correctly. Users reported that they cannot retrieve data for the date range they specified correctly. The selected dates from the current year (e.g., 2024) and then edited 2024 to, say, 2018 for both from and end date. The retrieved data only contain data from 2024, not from 2018. If this is a not an easy fix, then we need to prevent the date range text boxes from being edited by typing OR put a note on the UI saying something like "Please select the dates from the date picker only. The tool will not recognize any edited date information."

lbross commented 2 months ago

I didn't make any changes to this and looking at it, I'm not sure how it is supposed to work. There are multiple date fields. It appears that the top date field drives the snodas data that displays on the map. Is this correct? When I type dates in, the date picker responds and it looks like the display changes correctly.

But I think you are asking about the dates at the bottom? I will need to look at that later.

jdduh commented 2 months ago

Chrome behaves correctly. It was the Edge browser! Please give it a try. In this case, we might want to just warn the users that Edge browser might misbehave.

image

image

jdduh commented 2 months ago

Take that back. It happens in Chrome too. It seems that the UI needs to be refreshed to read the entered date values correctly. For example, if I enter the dates first (by keyboard strokes) and then select a different AOI, then the entered date texts become effective.

lbross commented 2 months ago

I have to debug this with alert statements since it's not intuitive how it's wired together. I can tell you that there are some validation routines that run when the date is changed with the picker but not when the date is typed in. These may be updating separate fields that are the fields that the api is using to write the query. I haven't been able to determine which fields the api uses. Maybe @jkeifer has some documentation that I am unaware of? I'll keep digging though and am nowhere near ready to throw in the towel.

Can you confirm that this is only a problem with the date range tool? It looks like the DOY and streamflow regression tools use select lists to choose the year.

lbross commented 2 months ago

I may have found a fix for this. I added event handlers to the two textboxes that set the begin and/or end dates in the datepicker which triggers the validation function which correctly sets the required fields for the api. I initially added event handlers to the textboxes to trigger the validation function but this wasn't enough. It appears there is something inside the datepicker that prevents you from setting the end date earlier than the start date. I could have written some new validation, but this seems more compact. The test python web server is running on atlas with this change. Please take a look and let me know what you think. Hopefully the server will keep running when I disconnect from atlas.

jdduh commented 2 months ago

Seems to be working. Thanks for fixing this. Please deploy it.

lbross commented 2 months ago

I submitted a PR to @jkeifer for deployment on basins. Actually 2 because I goobered the first one. In the meantime, as you discovered, the workaround is to refresh the UI which triggers the validation function.