Natixar / natixar-frontend

The static front end of the Natixar SaaS platform
0 stars 5 forks source link

Erratic behavior of date range selector #29

Closed lepeuvedic-natixar closed 2 months ago

lepeuvedic-natixar commented 2 months ago

Problem: It's impossible to chose a start and an end date. When the start date is set, the end date always changes to "today" (23/4/2024) and when the end date is set, the start date always changes to "one year ago" (23/4/2023). The effect of the buttons 6 months, 12 month, 24 months can be achieved by setting the start date.

Steps to reproduce: 1 - Enter the dashboard 2 - Select the date range picker 3 - Change the end date 4 - Change the start date 5 - Observe the end date has been reset to "today" 6 - Change the end date again 7 - Observe the start date has been reset to "one year ago".

What it should do instead: The date range picker should

Note that a complex behavior of the time step selection buttons is also required. At any time, the selection of a "large" time step which cannot be satisfied with at last one step given the date alignment constraints, should be rejected (button inactive with a clear explanation in the hover bubble, like "Time step is too large to represent the current time range". And also at any time, the selection of a "small" time step, which would put an excessive workload on the servers (hourly date over a 10 year range) and would be slow to process in the front end should be rejected (button inactive with a clear explanation in the hover bubble, like "This small time step would request an excessive amount of data given the current date range".

With all three guards in place, the back-end should never need to reject the front-end request, and it should not be too puzzling for the user either, when a time step button suddenly becomes inactive.

lepeuvedic-natixar commented 2 months ago

Not fixed. Same behavior.

benjaminpeuple commented 2 months ago

Issue fixed. See https://github.com/benjaminpeuple/natixar-front/pull/2

Conclusion: The problem is due to the fact that the timeRange dependency was not updated correctly in the different callbacks.

Fix: I just had to add timeRange in the different reloading callbacks.

As for the rest of the feature, I will add it later. @lepeuvedic-natixar can we close this issue since the main bug is fixed and create a "feature" ticket instead?