Skip to content

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

Merged
ChuckBuilds merged 4 commits intoChuckBuilds:mainfrom
sarjent:feat/masters-dynamic-dates-divider-config
Apr 14, 2026
Merged

masters-tournament: dynamic annual date detection + configurable course card divider#101
ChuckBuilds merged 4 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 hole cards (two-column divider or single-cell presentation).
    • New config option to control how many days tournament content remains displayed after the final round.
  • Improvements

    • More accurate Masters tournament date/phase detection and timezone-aware fallback logic.
  • Other

    • Plugin updated to version 2.4.1; metadata timestamps refreshed.

- 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

Warning

Rate limit exceeded

@sarjent has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fce1b4c5-f146-47cc-8da1-cee2bca7e59d

📥 Commits

Reviewing files that changed from the base of the PR and between cf92fae and 2494d34.

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

Walkthrough

Bumps masters-tournament to v2.4.1 and updates root plugin index; adds config option post_tournament_display_days and display_modes.course_tour.show_divider; introduces timezone-aware Masters Thursday calculation (_masters_thursday) and updates phase/countdown logic; threads show_divider through hole-card renderers and manager.

Changes

Cohort / File(s) Summary
Index / Manifest
plugins.json, plugins/masters-tournament/manifest.json
Updated root last_updated; bumped plugin version 2.3.0 → 2.4.1 and inserted versions[] entries for 2.4.1 and 2.4.0.
Config Schema
plugins/masters-tournament/config_schema.json
Added post_tournament_display_days (integer 0..14, default 1) and display_modes.course_tour.show_divider (boolean, default true); updated property order.
Timing / Helpers / Data
plugins/masters-tournament/masters_helpers.py, plugins/masters-tournament/masters_data.py
Added _masters_thursday(year) (UTC noon) and replaced prior "second Thursday" heuristics; extended get_detailed_phase(..., post_tournament_display_days) and updated fallback phase classification to use computed Thursday in Eastern calendar; masters_data delegates off-season fallback to helper.
Manager / Countdown
plugins/masters-tournament/manager.py
Switched fallback countdown to timezone-aware datetime.now(timezone.utc) + _masters_thursday(...); manager reads and stores post_tournament_display_days and show_divider and passes them into phase computation and renderer call sites.
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 signatures; enhanced renderer threads show_divider into helper paths and conditionally draws divider/background when true.

Sequence Diagram(s)

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

  Config->>Manager: provide post_tournament_display_days, show_divider
  Manager->>Helpers: request _masters_thursday(current_year)
  Helpers-->>Manager: return Thursday datetime (UTC 12:00)
  Manager->>Helpers: get_detailed_phase(now, post_tournament_display_days)
  Helpers-->>Manager: phase (tournament/practice/post-tournament/etc.)
  Manager->>Data: (when needed) compute start/end datetimes for display
  Data-->>Manager: start/end datetimes
  Manager->>Renderer: render_hole_card(hole, ..., show_divider=config.show_divider)
  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 the two main changes: dynamic annual date detection for Masters tournament and a configurable course card divider setting.

✏️ 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

Comment thread plugins/masters-tournament/manager.py
sarjent and others added 2 commits April 10, 2026 17:44
… target is past

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows users to control how many days after the final round tournament
results continue to display before the countdown takes over. Default is
1 day (unchanged from previous behavior). Set to 0 for immediate
switchover or up to 14 days to extend the post-tournament window.

Both the live ESPN date-driven path and the dynamic Thursday fallback
path in get_detailed_phase respect the new setting.

Bumps to v2.4.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

🧹 Nitpick comments (1)
plugins/masters-tournament/manager.py (1)

469-474: show_divider is not passed consistently to all hole card renders.

The show_divider preference is read and passed here, but the same parameter is missing in two other locations that also render hole cards:

  1. _display_featured_holes (line 497):

    return self._show_image(self.renderer.render_hole_card(hole))
  2. get_vegas_content (lines 594-596):

    card = self.renderer.render_hole_card(
        hole, card_width=cw, card_height=ch,
    )

If this is a user preference, it should apply uniformly across all hole card displays.

♻️ Proposed fix for consistency
 def _display_featured_holes(self, force_clear: bool) -> bool:
     featured = [12, 13, 15, 16]
     now = time.time()
     last = self._last_hole_advance.get("featured", 0)
     if last > 0 and now - last >= self._hole_switch_interval:
         self._featured_hole_index += 1
         self._last_hole_advance["featured"] = now
     elif last == 0:
         self._last_hole_advance["featured"] = now
     hole = featured[self._featured_hole_index % len(featured)]
-    return self._show_image(self.renderer.render_hole_card(hole))
+    show_divider = self.config.get("display_modes", {}).get(
+        "course_tour", {}
+    ).get("show_divider", True)
+    return self._show_image(self.renderer.render_hole_card(hole, show_divider=show_divider))

Similarly for get_vegas_content:

+    show_divider = self.config.get("display_modes", {}).get(
+        "course_tour", {}
+    ).get("show_divider", True)
+
     for hole in range(1, 19):
         card = self.renderer.render_hole_card(
-            hole, card_width=cw, card_height=ch,
+            hole, card_width=cw, card_height=ch, show_divider=show_divider,
         )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/manager.py` around lines 469 - 474, The
show_divider preference is read in manager.py but only applied when rendering
the current hole card; fix by reading the same configuration (display_modes ->
course_tour -> show_divider) into a local variable (as done where _current_hole
is rendered) and pass show_divider into every call to
renderer.render_hole_card—specifically update _display_featured_holes (where it
currently calls render_hole_card(hole)) and get_vegas_content (where it calls
render_hole_card(hole, card_width=cw, card_height=ch)) to include
show_divider=show_divider so the user preference is applied consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@plugins/masters-tournament/manager.py`:
- Around line 469-474: The show_divider preference is read in manager.py but
only applied when rendering the current hole card; fix by reading the same
configuration (display_modes -> course_tour -> show_divider) into a local
variable (as done where _current_hole is rendered) and pass show_divider into
every call to renderer.render_hole_card—specifically update
_display_featured_holes (where it currently calls render_hole_card(hole)) and
get_vegas_content (where it calls render_hole_card(hole, card_width=cw,
card_height=ch)) to include show_divider=show_divider so the user preference is
applied consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5b465f2-7e6d-44b7-a8de-4bb4cbb85ca7

📥 Commits

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

📒 Files selected for processing (5)
  • plugins.json
  • plugins/masters-tournament/config_schema.json
  • plugins/masters-tournament/manager.py
  • plugins/masters-tournament/manifest.json
  • plugins/masters-tournament/masters_helpers.py
✅ Files skipped from review due to trivial changes (1)
  • plugins/masters-tournament/manifest.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins.json
  • plugins/masters-tournament/config_schema.json

…card renders

_display_featured_holes and get_vegas_content were calling render_hole_card
without show_divider, ignoring the user's config. Both now read the same
display_modes -> course_tour -> show_divider setting as _display_course_tour.

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.

2 participants