Skip to content

Resolve "STUDY PROD BUG: Query runner can't be started when there are open questions shown for today on the homepage"

Closes #152 (closed)

Bug description

In the code we create dates by new Date('YYYY-MM-dd') and then iterate between the dates.
Problem: When creating a date in summer time e.g new Date('2022-10-05') we get Date Wed Oct 05 2022 02:00:00 GMT+0200 (Mitteleuropäische Sommerzeit) wehereas if we create an object in the wintertime e.g. new Date('2022-11-2') we get Date Wed Nov 02 2022 01:00:00 GMT+0100 (Mitteleuropäische Normalzeit).
Adding a day on the first one will in the end leave us with a date at 02:00:00 which we compare against one with 01:00:00 which is not the same or less as we expect.

How I found the solution

The error showed that currentQueryControls was undefined.
When I checked queryControlRecords had a value though - which meant that in updateCurrentQueryControls this.queryControlRecords[this.selectedDate] did not return a correct value.
In updateStats I noticed that stats.today was undefined which lead to the same function.
Then I noticed that the current date is missing in the list which then lead me to getQueryControls and on to DateString.getRange.

Future

IMHO we should create a ticket to get rid of all custom date functions and replace them with the library.
Dates always create problems in projects and handling them one self has never in my experience been a good solution.

Edited by Carlos Sanchez

Merge request reports

Loading