Natixar / natixar-frontend

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

State Mixes Up Date Range Picker TImeWindow and Response TimeWindow(s) #99

Open lepeuvedic opened 5 months ago

lepeuvedic commented 5 months ago

Problem

When the UI is refreshed, which is often, the dates from the date range picker replace the dates from the back-end response in the global state vector. The result is an inconsistent display of data at the wrong date: a serious bug of the incorrect data kind.

The behaviour changed after a fix to the front end navigation.

How to Reproduce

  1. Authenticate if needed and enter the Dashboard
  2. Observe that the date range always follows the data range picker when the backend response concerns other dates.

Desired Behaviour

Since the back-end can supply serveral date ranges at once, the front end should also support several date ranges at different time scales. As a minimum first step the state vector variables storing the requested date range (filters) and the actual time range (from the response) shall be distinct.

The new /scenarios API has a zero parameter mode which returns data covering the entire available data history at the most suitable time step.

In a second step, the front-end should use the capability to request several time ranges at once to get data for all the charts on all the pages at once, and shall store the multiple data sets returned by the back-end.

ChrisNatixar commented 5 months ago

Fix has been implemented in commented out version of emissionsGroupByTime in EmissionTransformers. This prefills the timeKey array to match the datepicker values. This update will also need to be copied over to emissionsIntensityGroupByTime.

Waiting for real backend data to test this fully works before making release, test data always returns same time range so cannot validate properly.