Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Filter future seasons out from the data sent to the stats page #163

Closed
itsalaidbacklife opened this issue Oct 14, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@itsalaidbacklife
Copy link
Contributor

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:
image

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

@itsalaidbacklife itsalaidbacklife added enhancement New feature or request hacktoberfest This issue welcomes contributions for Hacktoberfest. labels Oct 14, 2022
@itsalaidbacklife itsalaidbacklife removed the hacktoberfest This issue welcomes contributions for Hacktoberfest. label Nov 1, 2022
@P-DR0ZD
Copy link
Contributor

P-DR0ZD commented Nov 9, 2022

Can I work on this @itsalaidbacklife

@itsalaidbacklife
Copy link
Contributor Author

@P-DR0ZD Yes please do! Please feel free to ask any questions you have here or in discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants