You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the stats page displays all the available Seasons that are listed in the database. We should the backend endpoint that services the stats page to filter out the future seasons (start time is after current time).
Detailed Description
Currently if seasons are added to the database (e.g. Spades 2023) for a future start time, they will be displayed in the Stats page, and the latest-starting one will be pre-selected in the dropdown at the top of the page like so:
This is unideal from a maintenance standpoint because it means we need to wait until the end of the previous season to add the new one to the database. It would be much more efficient to have the backend endpoint that generates the stats payload to filter out the seasons that haven't started yet. That way we could add future seasons in one big batch without worrying about waiting until just before they start.
To do this we should update api/helpers/get-seasons-without-rankings.js which is a helper used to fetch the seasons. In that function, the query for all the seasons should receive an additional where clause to filter down to the seasons that are only have a start time that is less than the current time. See line 7 of that function:
const seasons = await Season.find({ sort: 'startTime DESC' }).populateAll(); // this should update to set the `where` inside the .find()
The where clause can be set according to the sails docs on querying and the current time should be calculated using dayjs().valueOf() (docs) which should compute the current time in milliseconds
The text was updated successfully, but these errors were encountered:
Feature Summary
Currently the stats page displays all the available Seasons that are listed in the database. We should the backend endpoint that services the stats page to filter out the future seasons (start time is after current time).
Detailed Description
Currently if seasons are added to the database (e.g. Spades 2023) for a future start time, they will be displayed in the Stats page, and the latest-starting one will be pre-selected in the dropdown at the top of the page like so:
This is unideal from a maintenance standpoint because it means we need to wait until the end of the previous season to add the new one to the database. It would be much more efficient to have the backend endpoint that generates the stats payload to filter out the seasons that haven't started yet. That way we could add future seasons in one big batch without worrying about waiting until just before they start.
To do this we should update
api/helpers/get-seasons-without-rankings.js
which is a helper used to fetch the seasons. In that function, the query for all the seasons should receive an additionalwhere
clause to filter down to the seasons that are only have a start time that is less than the current time. See line 7 of that function:The where clause can be set according to the sails docs on querying and the current time should be calculated using
dayjs().valueOf()
(docs) which should compute the current time in millisecondsThe text was updated successfully, but these errors were encountered: