Skip to content

fix(masters): paginate course overview across all 18 holes#87

Merged
ChuckBuilds merged 3 commits intomainfrom
fix/masters-course-overview-pagination
Apr 2, 2026
Merged

fix(masters): paginate course overview across all 18 holes#87
ChuckBuilds merged 3 commits intomainfrom
fix/masters-course-overview-pagination

Conversation

@ChuckBuilds
Copy link
Copy Markdown
Owner

@ChuckBuilds ChuckBuilds commented Apr 2, 2026

Summary

  • Course overview only had 2 pages (front nine / back nine) and broke early when holes didn't fit on screen — only holes 1-3 and 10-12 were ever visible
  • Now calculates max_holes from available display height and paginates all 18 holes, matching the pattern used by render_past_champions and render_leaderboard
  • Dynamic title (FRONT NINE / BACK NINE / FRONT/BACK) based on which holes are on the current page
  • Page dots correctly reflect total page count

Other paginated modes (leaderboard, past_champions, tournament_stats, schedule) were verified to already use the correct total_pages + slice pattern and are unaffected.

Test plan

  • Enable Masters plugin with course_overview mode on a 64px display
  • Watch for 15+ seconds — pages should cycle through all 18 holes (e.g., 1-3, 4-6, 7-9, 10-12, 13-15, 16-18)
  • Verify page dots update correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • UI/UX Improvements
    • Countdown now shows days/hours, hours:minutes, or "NOW" with context-specific labels for clearer timing.
    • Adjusted logo sizing, placement, and label positioning for better balance in large two-column countdowns.
    • Course overview now paginates all 18 holes dynamically, fitting as many holes as space allows and showing accurate page indicators.

render_course_overview only split holes into 2 pages (front/back nine)
and broke early when holes didn't fit on screen, silently dropping
holes 4-9 and 13-18. Now calculates how many holes fit and paginates
across all 18 holes, matching the pattern used by render_past_champions
and render_leaderboard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

Updated rendering logic: masters_renderer.py changes countdown text, labels, and layout across tiers; masters_renderer_enhanced.py changes course overview pagination to compute pages/holes dynamically from available vertical space.

Changes

Cohort / File(s) Summary
Countdown Display Logic
plugins/masters-tournament/masters_renderer.py
Reworked render_countdown: new formatting rules for days/hours/minutes and label selection (UNTIL THE MASTERS / HOURS TO GO / NOW), adjusted logo sizing/positioning for large and compact tiers, unified vertical centering of number+label block, and removed prior width-based label switch.
Course Overview Pagination
plugins/masters-tournament/masters_renderer_enhanced.py
Replaced fixed front/back nine split with dynamic pagination: compute max_holes from usable height, derive total_pages, normalize page via modulo, slice holes per page, and render footer with dynamic page count; removed per-hole cutoff in loop.

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 66.67% 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 PR title accurately describes the main focus of the changeset: paginating course overview across all 18 holes. This is the primary change highlighted in the PR objectives and summary.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/masters-course-overview-pagination

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.

- Compact layout logo increased from 48x20 max to 56x28 max, and
  positioned to use available space better
- Large layout logo reduced from 55% to 45% width to give more room
  for the countdown text
- Countdown now shows "8d 14h" instead of just "8" when days > 0,
  and "HOURS TO GO" instead of "HOURS" for sub-day countdowns
- Text positioned dynamically below logo instead of at fixed mid_y

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
plugins/masters-tournament/masters_renderer.py (2)

1-15: ⚠️ Potential issue | 🟡 Minor

Bump PATCH version in manifest.json and init.py.

The commit "fix(masters): enlarge countdown logo and show days + hours" is a bug fix and requires a PATCH version bump per coding guidelines. Update version from 2.0.0 to 2.0.1 in plugins/masters-tournament/manifest.json and plugins/masters-tournament/__init__.py.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/masters_renderer.py` around lines 1 - 15, Update
the package PATCH version from 2.0.0 to 2.0.1 in both plugin manifest and module
init: open plugins/masters-tournament/manifest.json and change the "version"
field value to "2.0.1", then open plugins/masters-tournament/__init__.py and
update the __version__ (or VERSION) constant from "2.0.0" to "2.0.1" so both
sources match the new patch release.

854-874: ⚠️ Potential issue | 🟡 Minor

Duplicate text rendering in large display layout when countdown is in days or hours mode.

When days > 0 or hours > 0, the same text appears at both the top and bottom of the countdown block:

  • Line 866 renders until_text (which equals unit_text) at the top
  • Lines 872-875 render unit_text again at the bottom

For example, when 5 days remain, "UNTIL THE MASTERS" displays above and below the "5d 14h" countdown. This redundancy wastes display space and creates visual clutter on the limited large display (128x64).

The suggested fix is reasonable: only display the bottom unit label when days <= 0 (hours mode), avoiding duplication in the more common days-countdown scenario where the full label already appears at the top.

Suggested fix
                 count_y = block_y + detail_h + 2
                 self._text_shadow(draw, (right_cx - cw // 2, count_y),
                                   count_text, self.font_score, COLORS["masters_yellow"])
-                if unit_text:
+                if unit_text and days <= 0:
                     uw = self._text_width(draw, unit_text, self.font_detail)
                     draw.text((right_cx - uw // 2, count_y + count_h + 2),
                               unit_text, fill=COLORS["light_gray"], font=self.font_detail)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/masters_renderer.py` around lines 854 - 874, The
top label (until_text) is being drawn and then unit_text is drawn again below
when days>0/hours>0 causing duplicate labels; update the rendering logic in the
large layout block (the code around until_text, unit_text, draw.text, and the
bottom draw of unit_text) so that the bottom label is only drawn when days <= 0
(i.e., hours-mode), leaving the existing top draw (and its "TO MASTERS"
fallback) unchanged; conditionally wrap the bottom draw of unit_text (the
draw.text call at count_y + count_h + 2) with a check on days so it is skipped
for days>0.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@plugins/masters-tournament/masters_renderer.py`:
- Around line 1-15: Update the package PATCH version from 2.0.0 to 2.0.1 in both
plugin manifest and module init: open plugins/masters-tournament/manifest.json
and change the "version" field value to "2.0.1", then open
plugins/masters-tournament/__init__.py and update the __version__ (or VERSION)
constant from "2.0.0" to "2.0.1" so both sources match the new patch release.
- Around line 854-874: The top label (until_text) is being drawn and then
unit_text is drawn again below when days>0/hours>0 causing duplicate labels;
update the rendering logic in the large layout block (the code around
until_text, unit_text, draw.text, and the bottom draw of unit_text) so that the
bottom label is only drawn when days <= 0 (i.e., hours-mode), leaving the
existing top draw (and its "TO MASTERS" fallback) unchanged; conditionally wrap
the bottom draw of unit_text (the draw.text call at count_y + count_h + 2) with
a check on days so it is skipped for days>0.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 811eaa80-0c2d-451d-b061-ea35e2f3ff14

📥 Commits

Reviewing files that changed from the base of the PR and between 9f9b54c and 35a5f32.

📒 Files selected for processing (2)
  • plugins/masters-tournament/masters_renderer.py
  • plugins/masters-tournament/masters_renderer_enhanced.py

Show the big countdown number first (8d 14h), with "UNTIL THE MASTERS"
underneath in gray — cleaner than repeating the label above and below.

Co-Authored-By: Claude Opus 4.6 (1M context) <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/masters_renderer.py (1)

889-903: Minor vertical centering improvement for the "NOW" case.

When unit_text is empty (the "NOW" state), text_block_h still includes 2 + detail_h for the label, causing "NOW" to render slightly above vertical center on non-tiny compact displays. Consider conditionally omitting the label height:

♻️ Optional: tighten vertical centering when label is empty
         label = unit_text

-    text_block_h = count_h + 2 + detail_h
+    text_block_h = count_h + (2 + detail_h if label else 0)
     text_y = logo_bottom + max(0, (remaining - text_block_h) // 2)

     cw = self._text_width(draw, count_text, self.font_score)
     self._text_shadow(draw, ((self.width - cw) // 2, text_y),
                       count_text, self.font_score, COLORS["masters_yellow"])

-    lw = self._text_width(draw, label, self.font_detail)
-    draw.text(((self.width - lw) // 2, text_y + count_h + 2),
-              label, fill=COLORS["light_gray"], font=self.font_detail)
+    if label:
+        lw = self._text_width(draw, label, self.font_detail)
+        draw.text(((self.width - lw) // 2, text_y + count_h + 2),
+                  label, fill=COLORS["light_gray"], font=self.font_detail)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/masters_renderer.py` around lines 889 - 903, The
vertical centering is off when unit_text is empty because text_block_h always
adds the label height (2 + detail_h); update the logic in the block that
computes text_block_h and draws the label (references: self.tier, unit_text,
label, text_block_h, detail_h, text_y, draw.text, self._text_width,
self.font_detail) so that when unit_text == "" (the "NOW" case) you omit the
extra 2 + detail_h from text_block_h and skip drawing the label (or draw
nothing), then recompute lw only when drawing the label; this ensures count_text
is vertically centered correctly on non-tiny compact displays.
🤖 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/masters_renderer.py`:
- Around line 889-903: The vertical centering is off when unit_text is empty
because text_block_h always adds the label height (2 + detail_h); update the
logic in the block that computes text_block_h and draws the label (references:
self.tier, unit_text, label, text_block_h, detail_h, text_y, draw.text,
self._text_width, self.font_detail) so that when unit_text == "" (the "NOW"
case) you omit the extra 2 + detail_h from text_block_h and skip drawing the
label (or draw nothing), then recompute lw only when drawing the label; this
ensures count_text is vertically centered correctly on non-tiny compact
displays.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66a2ecb1-437c-4f6d-ae57-265bb03c10c6

📥 Commits

Reviewing files that changed from the base of the PR and between 35a5f32 and 5fb877f.

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

@ChuckBuilds ChuckBuilds merged commit a922a07 into main Apr 2, 2026
1 check passed
@ChuckBuilds ChuckBuilds deleted the fix/masters-course-overview-pagination branch April 2, 2026 14:08
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