fix(ufc-scoreboard): draw the upcoming card, and document all 87 settings - #438
Merged
Conversation
…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>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 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 |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 18 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Every upcoming fight card rendered blank in switch mode — the default.
MMAUpcoming._draw_scorebug_layoutdrew the two fighters' short names withself.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:
sports.py::_load_fonts, inherited bymma.py's switch cardsscore,time,team,status,detail,rank,recordfight_renderer.py::_load_fonts, used by the scroll cardsfighter_name,status,result,detail,time,score,odds,recordOnly the second has
odds. Reaching for it from the first raisedKeyError: 'odds', the enclosingtryloggedError displaying upcoming fight: 'odds', anddisplay()returned having drawn nothing.ufc_liveandufc_recentwere 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_rendererloads both itsoddsand itsfighter_namefaces as4x6-font.ttfat size 6, anddetailin 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.
Three things the old README got wrong:
assets/sports/ufc_fighters/. They go to the plugin's logo directory —assets/sports/ufc_logos/, named by ESPN fighter id.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.broadcastas another_games_min_qualitychoice and claimed it works here. The enum is["any", "ranked"], andbroadcastwas retired (Scoreboard schemas describe an other_games_min_quality value the enum does not offer #426).Also newly documented:
mode_durationsdoes not exist in this plugin;show_favorite_fighters_onlydefaults off andshow_all_livedefaults on, both opposite to the team scoreboards; andcustomization.<element>.fonttakes a full file path here rather than a font name.Checks
check_plugin.py: 24/24 PASS, zero FAIL, before and after the fixadditionalPropertiesconfig_schema.jsonplugins.jsonregeneratedDoes not touch the shared
sports.pylineage; the change is inmma.py, which is UFC-only.Dependency
Carries the docs-tooling commits from #423 so this branch renders standalone.
🤖 Generated with Claude Code