Skip to content

fix(ufc-scoreboard): draw the upcoming card, and document all 87 settings - #438

Merged
ChuckBuilds merged 1 commit into
mainfrom
docs/ufc-readme
Sep 4, 2026
Merged

fix(ufc-scoreboard): draw the upcoming card, and document all 87 settings#438
ChuckBuilds merged 1 commit into
mainfrom
docs/ufc-readme

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

The bug

Every upcoming fight card rendered blank in switch mode — the default.

MMAUpcoming._draw_scorebug_layout drew the two fighters' short names with self.fonts["odds"] (mma.py:669, 680, 685). That key does not exist in the fonts dict the switch cards use.

Two font dictionaries exist in this plugin:

Built by Keys
sports.py::_load_fonts, inherited by mma.py's switch cards score, time, team, status, detail, rank, record
fight_renderer.py::_load_fonts, used by the scroll cards fighter_name, status, result, detail, time, score, odds, record

Only the second has odds. Reaching for it from the first raised KeyError: 'odds', the enclosing try logged Error displaying upcoming fight: 'odds', and display() returned having drawn nothing. ufc_live and ufc_recent were unaffected — they use keys that exist.

Filed as #437.

The fix uses fonts["detail"] at those three sites. That is the faithful substitute rather than an arbitrary one: fight_renderer loads both its odds and its fighter_name faces as 4x6-font.ttf at size 6, and detail in the switch dict is the same face at the same size — identical glyph metrics, so the layout is unchanged.

The harness passed before and after. A blank panel draws nothing out of bounds, so all 24 checks were green while the mode was completely broken. It took rendering the mode and looking at the image.

Docs

All 87 schema leaves documented (token audit: 0 undocumented), four renders, and the Alex Resnick attribution plus the LEDMatrix PR #137 link kept.

display modes

Three things the old README got wrong:

  • It said headshots cache in assets/sports/ufc_fighters/. They go to the plugin's logo directory — assets/sports/ufc_logos/, named by ESPN fighter id.
  • It said a failed headshot download "falls back to a placeholder icon". It does not — the card draws the text Image Error. There is no per-fighter placeholder, unlike the team scoreboards which generate one from the abbreviation. I hit this directly while building the fixture.
  • It listed broadcast as an other_games_min_quality choice and claimed it works here. The enum is ["any", "ranked"], and broadcast was retired (Scoreboard schemas describe an other_games_min_quality value the enum does not offer #426).

Also newly documented: mode_durations does not exist in this plugin; show_favorite_fighters_only defaults off and show_all_live defaults on, both opposite to the team scoreboards; and customization.<element>.font takes a full file path here rather than a font name.

Checks

  • check_plugin.py: 24/24 PASS, zero FAIL, before and after the fix
  • Config-token audit: 87 schema leaves, 0 undocumented
  • Every example config validated against the schema, including additionalProperties
  • Every documented default read back from config_schema.json
  • Manifest bumped 1.8.1 -> 1.8.2 (PATCH — bug fix plus docs), plugins.json regenerated

Does not touch the shared sports.py lineage; the change is in mma.py, which is UFC-only.

Dependency

Carries the docs-tooling commits from #423 so this branch renders standalone.

🤖 Generated with Claude Code

…ings

Every upcoming fight card rendered blank in switch mode -- the default.
MMAUpcoming._draw_scorebug_layout drew the two fighters' short names
with self.fonts["odds"], and that key does not exist in the fonts dict
the switch cards use.

Two font dictionaries exist in this plugin. sports.py::_load_fonts,
which mma.py's switch cards inherit, builds score/time/team/status/
detail/rank/record. fight_renderer.py::_load_fonts, used by the scroll
cards, builds fighter_name/status/result/detail/time/score/odds/record.
Only the second has "odds". Reaching for it from the first raised
KeyError, the enclosing try logged "Error displaying upcoming fight:
'odds'", and display() returned having drawn nothing.

Fixed by using fonts["detail"] at those three sites. That is the
faithful substitute rather than an arbitrary one: fight_renderer loads
both its odds and its fighter_name faces as 4x6-font.ttf at size 6, and
detail in the switch dict is the same face at the same size, so glyph
metrics and layout are unchanged. Filed as #437.

The render-safety harness passed before and after -- a blank panel
draws nothing out of bounds -- which is why this survived. It took
rendering the mode and looking at the image.

The README also gets the treatment the other scoreboards had: all 87
schema leaves documented, verified by a token audit, with four renders.
Kept the Alex Resnick attribution and the LEDMatrix PR #137 link.

Three things the old README got wrong:

- It said headshots cache in assets/sports/ufc_fighters/. They go to
  the plugin's logo directory, assets/sports/ufc_logos/, named by ESPN
  fighter id.
- It said a failed headshot download falls back to a placeholder icon.
  It does not -- the card draws the text "Image Error" instead. There
  is no per-fighter placeholder, unlike the team scoreboards.
- It listed broadcast as an other_games_min_quality choice and claimed
  it works here. The enum is any/ranked, and broadcast was retired.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 17febbcd-83ba-4169-8f43-3c0e9fdb3703


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.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 18 complexity

Metric Results
Complexity 18

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds
ChuckBuilds merged commit bc69275 into main Sep 4, 2026
4 checks passed
@ChuckBuilds
ChuckBuilds deleted the docs/ufc-readme branch September 4, 2026 20:13
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