NHMDenmark / DaSSCo-asset-service

DaSSCo asset service is part of DaSSCo storage system
0 stars 0 forks source link

Statistic Dashboard - Issues Custom Ranges #69

Closed Grand666 closed 3 months ago

Grand666 commented 3 months ago

If we choose a custom range only once, it works as intended. But If i want to change the range, and go to set new range, a call to the backend occurs when I pick the startDate. And that is wrong, it should only send a request when I've selected both a startDate and endDate.

This will cause the "wrong" graph to "blink" in briefly before the correct graph shows up. But in some cases, the "wrong graph" dataset takes longer to receive than the correct, and it then overrides the correct one. This is shown on the image below, look at the date range and compare it to the actual dates on the X Axis.

Image

I believe it is cause, when picking a new startDate the old endDate is still saved in the Observable. And the condition to send the request is "if both startDate and endDate is present, send the request for the data".

So the fix could be, that when picking a new startDate clear the endDate. That way the request is only sent once the user picks the endDate.

Acceptance Criteria

Nicolas-Northtech commented 3 months ago

Fixed. Added mat-date-range-picker-actions to the html element. It basically adds two buttons to confirm or cancel the date picker action. When two dates are confirmed, the data is fetched, solving the problem of the data being fetched automatically when two dates are present.

Image