masters-tournament: dynamic annual date detection + configurable course card divider#101
Conversation
- 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>
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughBumps masters-tournament to v2.4.1 and updates root plugin index; adds config option Changes
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
plugins.jsonplugins/masters-tournament/config_schema.jsonplugins/masters-tournament/manager.pyplugins/masters-tournament/manifest.jsonplugins/masters-tournament/masters_data.pyplugins/masters-tournament/masters_helpers.pyplugins/masters-tournament/masters_renderer.pyplugins/masters-tournament/masters_renderer_enhanced.py
… 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>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugins/masters-tournament/manager.py (1)
469-474:show_divideris not passed consistently to all hole card renders.The
show_dividerpreference is read and passed here, but the same parameter is missing in two other locations that also render hole cards:
_display_featured_holes(line 497):return self._show_image(self.renderer.render_hole_card(hole))
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
📒 Files selected for processing (5)
plugins.jsonplugins/masters-tournament/config_schema.jsonplugins/masters-tournament/manager.pyplugins/masters-tournament/manifest.jsonplugins/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>
Summary
_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).show_dividerboolean toconfig_schema.jsonunderdisplay_modes.course_tour(defaulttrue). When set tofalse, 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
masters_helpers.py_masters_thursday(year); replace hardcoded fallback inget_tournament_phaseandget_detailed_phasemasters_data.py_computed_fallback_metaand_second_thursday_of_aprildelegate to_masters_thursdaymanager.py_display_countdownhard fallback uses dynamic date;_display_course_tourreadsshow_dividerconfigconfig_schema.jsonshow_dividerboolean underdisplay_modes.course_tourmasters_renderer.pyshow_divider=Trueparam torender_hole_cardfor API consistencymasters_renderer_enhanced.pyshow_dividerthrough all hole card render methods; suppress panel + divider line when falseTest plan
_masters_thursday(2022)returns April 7,_masters_thursday(2023)returns April 6,_masters_thursday(2028)returns April 6get_tournament_phase/get_detailed_phasereturn correct phases for edge-case years (2022, 2023, 2028)show_divider: falsein config and confirm course tour card renders as one unified green cell (no dark left panel, no yellow divider line)show_divider: true) is visually unchangedGenerated with Claude Code
Summary by CodeRabbit
New Features
Improvements
Other