masters-tournament: dynamic annual date detection + configurable course card divider#101
masters-tournament: dynamic annual date detection + configurable course card divider#101sarjent wants to merge 2 commits intoChuckBuilds:mainfrom
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughPlugin bumped to v2.4.0: adds a Changes
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
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>
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