FIX: Redo period filtering to respect leaderboard date bounds #178
+233
−178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change, ensures period filter works within the bounds of the leaderboard's configured date(s) if present. There is currently a bug in the relative period condition in the materialized view query which causes it to take precedence over the leaderboard's date range. Ideally, scores should always be constrained by the leaderboard's dates first, with the relative period filter applied afterward, if applicable.
This change ensures that the period filter respects the leaderboard's configured date bounds, if present.
For example, given a November 2024 leaderboard (i.e.
from_date = 2024-11-01
andto_date = 2024-11-30
) refreshed and queried on2025-12-02
:all_time
: No period window, only scores created from2024-11-01
to2024-11-30
yearly
: Period starting from2024-01-02
, only scores created from2024-11-01
to2024-11-30
quarterly
: Period starting from2024-10-02
, only scores created from2024-11-01
to2024-11-30
monthly
: Period starting from2024-12-02
, no scores because leaderboard'sto_date
is earlierweekly
: Period starting from2024-12-26
, no scores because leaderboard'sto_date
is earlierdaily
: Period starting from2025-01-01
, no scores because leaderboard'sto_date
is earlier