Skip to content

masters-tournament: dynamic annual date detection + configurable course card divider#101

Open
sarjent wants to merge 2 commits intoChuckBuilds:mainfrom
sarjent:feat/masters-dynamic-dates-divider-config
Open

masters-tournament: dynamic annual date detection + configurable course card divider#101
sarjent wants to merge 2 commits intoChuckBuilds:mainfrom
sarjent:feat/masters-dynamic-dates-divider-config

Conversation

@sarjent
Copy link
Copy Markdown
Contributor

@sarjent sarjent commented Apr 10, 2026

Summary

  • Dynamic Masters start date - replaces the hardcoded April 10-13 fallback (and the incorrect 'second Thursday of April' algorithm) with a _masters_thursday(year) helper that finds the Thursday falling between April 6-12 inclusive. This is the correct rule, verified against historical data 2022-2028. The old algorithm produced wrong dates for 2022 (Apr 13 vs actual Apr 7) and 2023 (Apr 13 vs actual Apr 6).
  • Configurable course card divider - adds a show_divider boolean to config_schema.json under display_modes.course_tour (default true). When set to false, both the yellow vertical separator line and the dark left-panel background are suppressed, so the hole card renders as a single unified green cell rather than two columns.

Files changed

File Change
masters_helpers.py Add _masters_thursday(year); replace hardcoded fallback in get_tournament_phase and get_detailed_phase
masters_data.py _computed_fallback_meta and _second_thursday_of_april delegate to _masters_thursday
manager.py _display_countdown hard fallback uses dynamic date; _display_course_tour reads show_divider config
config_schema.json Add show_divider boolean under display_modes.course_tour
masters_renderer.py Add show_divider=True param to render_hole_card for API consistency
masters_renderer_enhanced.py Thread show_divider through all hole card render methods; suppress panel + divider line when false

Test plan

  • Verify _masters_thursday(2022) returns April 7, _masters_thursday(2023) returns April 6, _masters_thursday(2028) returns April 6
  • Confirm get_tournament_phase / get_detailed_phase return correct phases for edge-case years (2022, 2023, 2028)
  • Set show_divider: false in config and confirm course tour card renders as one unified green cell (no dark left panel, no yellow divider line)
  • Confirm default behavior (show_divider: true) is visually unchanged

Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Configurable divider toggle for course tour cards—choose two-column layout with divider or a cleaner single-cell presentation.
  • Improvements

    • More accurate Masters tournament date calculation and phase detection for correct scheduling and live/practice/off-season classification.
  • Other

    • Plugin updated to version 2.4.0 (release metadata added).

- Add _masters_thursday(year) helper (Thursday in April 6-12) replacing the
  incorrect second-Thursday-of-April logic; fixes 2022, 2023, 2028 start dates
- Update get_tournament_phase / get_detailed_phase fallbacks to use dynamic dates
- Update _computed_fallback_meta and _display_countdown to use _masters_thursday
- Add show_divider config option to course_tour display; when false, suppresses
  the yellow vertical line and the dark left-panel background so the card
  renders as one unified green cell

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88a8e476-ccae-44fb-a8b0-ffc6ea87280f

📥 Commits

Reviewing files that changed from the base of the PR and between cbfdc55 and fb0f493.

📒 Files selected for processing (1)
  • plugins/masters-tournament/manager.py

📝 Walkthrough

Walkthrough

Plugin bumped to v2.4.0: adds a show_divider course_tour config and threads it through hole-card renderers; introduces _masters_thursday(year) and switches phase/countdown fallbacks to use this timezone-aware computation.

Changes

Cohort / File(s) Summary
Version & Metadata
plugins.json, plugins/masters-tournament/manifest.json
Bumped plugin version 2.3.0 → 2.4.0; added 2.4.0 release entry (2026-04-10, ledmatrix_min_version 2.0.0).
Config Schema
plugins/masters-tournament/config_schema.json
Added boolean display_modes.course_tour.show_divider (default: true).
Renderer API & Implementation
plugins/masters-tournament/masters_renderer.py, plugins/masters-tournament/masters_renderer_enhanced.py
Added show_divider: bool = True parameter to render_hole_card and threaded into enhanced rendering helpers; enhanced renderer conditionally draws left-panel/divider only when show_divider is true.
Manager integration & countdown
plugins/masters-tournament/manager.py
Manager now reads display_modes.course_tour.show_divider and passes it to renderer; countdown fallback uses timezone-aware now and _masters_thursday(year) instead of fixed April 10.
Tournament date/phase logic
plugins/masters-tournament/masters_helpers.py, plugins/masters-tournament/masters_data.py
Added _masters_thursday(year) (UTC 12:00) and replaced local "second Thursday" heuristics; updated get_tournament_phase/get_detailed_phase fallbacks to use computed Thursday in Eastern calendar terms; masters_data delegates to helper for off-season fallback date.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Manager as Manager
  participant Helpers as masters_helpers
  participant Renderer as MastersRenderer
  participant Data as masters_data

  Manager->>Helpers: request _masters_thursday(current_year)
  Helpers-->>Manager: return Thursday datetime (UTC 12:00)
  Manager->>Data: compute countdown window / phase using Thursday
  Data-->>Manager: phase / start/end datetimes
  Manager->>Renderer: render_hole_card(hole, ..., show_divider=config)
  Renderer-->>Manager: Image for hole card
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes both main changes: dynamic Masters date detection and configurable course card divider. It is specific, concise, and clearly communicates the primary objectives of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/masters-tournament/manager.py`:
- Line 12: The hard-countdown fallback currently constructs an April target
using the current year which can produce a past date after the tournament has
finished; update the fallback logic (used when fetch_tournament_meta() returns
empty) to compute now = datetime.now(timezone.utc), build the candidate target
for April of now.year, and if that candidate <= now, increment the year (year =
now.year + 1) before creating the datetime fallback (ensure
timezone=timezone.utc). Apply this change to the block that sets the fallback
countdown target so the countdown rolls to next year when the current-April date
is already past.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 47c00b98-aeb7-46f4-a189-00901e873471

📥 Commits

Reviewing files that changed from the base of the PR and between d9ee254 and cbfdc55.

📒 Files selected for processing (8)
  • plugins.json
  • plugins/masters-tournament/config_schema.json
  • plugins/masters-tournament/manager.py
  • plugins/masters-tournament/manifest.json
  • plugins/masters-tournament/masters_data.py
  • plugins/masters-tournament/masters_helpers.py
  • plugins/masters-tournament/masters_renderer.py
  • plugins/masters-tournament/masters_renderer_enhanced.py

… target is past

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant