Fix incorrect default seasons - #971
Open
shawnhdx0710 wants to merge 1 commit into
Open
shawnhdx0710 wants to merge 1 commit into
shawnhdx0710 wants to merge 1 commit into
Conversation
Author
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When no seasons are given, a reader defaults to the last 5 seasons. For a multi-year league (Aug-May), the current season ends in the next calendar year. The old code anchored the defaults on the calendar year. From August to December, it skipped the current season. In October 2024, the defaults stopped at 2023/24 and missed 2024/25. This fixes issue #740.
The change also fixes two related problems. The defaults contained 6 seasons, but the log message said 5. Single-year leagues fell one year behind.
What changed
The default-season generation moved to a new
_default_seasons(now)method inBaseReader. For a multi-year league, the end year shifts by one when the current month is at or past the season start (usually August). The method now returns exactly 5 seasons. It uses the same range format for both season-code types, so single-year leagues get the correct calendar years.Tests
Added
test_default_seasons. It checks the defaults for multi-year and single-year leagues at different times of the year.Fixes #740