Skip to content

Show the server community rating on phone and TV title pages - #42

Merged
JonahMMay merged 1 commit into
mainfrom
feat/community-rating
Oct 12, 2026
Merged

JonahMMay merged 1 commit into
mainfrom
feat/community-rating

Conversation

@JonahMMay

@JonahMMay JonahMMay commented Oct 12, 2026 •

Copy link
Copy Markdown

Title pages on phone and TV now show the server's community rating in the ratings row, after the external ratings: ★ 4.2 · 7 ratings.

Depends on the parallel prairie-server PR that adds community_rating ({ "average": 4.2, "count": 7 }) to item detail. Without it, or when a title has fewer than three ratings, the server omits the field and the entry stays hidden. Parsing tolerates the field's absence.

Changes

  • CommunityRating model; optional community_rating on ItemDetailReadV2 (the v2 detail read the app uses) and the domain ItemDetail (also covers the v1 shape and the detail cache).
  • ExternalRatings.community() builds the entry and titleRatings() appends it, so both phone layouts and the TV hero / series-episode facts lines pick it up with no screen changes. It returns null for values outside 1–5 or a count of zero.
  • forPhone() keeps the community entry past the three-external limit.
  • RatingEntry gives TalkBack "Community rating 4.2 · 7 ratings" in place of the star glyph.
  • One decoding test covers the field present and absent.

Notes

  • The app already has a user-rating input (setRating/clearRating on the phone and TV detail view models, backed by user_rating). This PR doesn't change it; it only displays the aggregate.
  • Not run on a device. CI is the build and test gate.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Item details can now display community ratings, including the average star rating and number of ratings, alongside external ratings.
    • Community ratings are also included in title rating displays when valid rating data is available.
  • Accessibility
    • Screen readers now identify community ratings as such, while other rating labels remain unchanged.

Decode the optional community_rating ({average, count}) on item detail
(v2 read model and the domain ItemDetail) and append it to the shared
ratings row as "★ 4.2 · 7 ratings". The row is hidden when the server
omits the field (older servers, or fewer than three ratings). On phone
widths the community entry rides after the three-external-rating limit.

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

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 970a1714-5c96-4805-a683-769846170c51

📥 Commits

Reviewing files that changed from the base of the PR and between 443f86f and bc4a4d4.


📒 Files selected for processing (5)
  • android-shared/src/androidMain/kotlin/org/prairieserver/prairie/common/ui/RatingEntry.kt
  • shared/src/commonMain/kotlin/org/prairieserver/prairie/model/catalog/CatalogModels.kt
  • shared/src/commonMain/kotlin/org/prairieserver/prairie/model/catalog/ExternalRatings.kt
  • shared/src/commonMain/kotlin/org/prairieserver/prairie/network/apiv2/CatalogDetailReadV2Models.kt
  • shared/src/commonTest/kotlin/org/prairieserver/prairie/model/catalog/MediaSurfaceContractSerializationTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

Catalog detail now carries an optional community rating. Valid ratings are formatted and added to title ratings after external ratings. On Android, community ratings use a dedicated screen-reader label.

Changes

Community Rating

Layer / File(s) Summary
Rating data and API mapping
shared/src/commonMain/kotlin/org/prairieserver/prairie/model/catalog/CatalogModels.kt, shared/src/commonMain/kotlin/org/prairieserver/prairie/network/apiv2/CatalogDetailReadV2Models.kt
ItemDetail gains an optional CommunityRating with average and count fields. The API read model deserializes community_rating and passes it to the domain model.
Community rating formatting
shared/src/commonMain/kotlin/org/prairieserver/prairie/model/catalog/ExternalRatings.kt, shared/src/commonTest/kotlin/org/prairieserver/prairie/model/catalog/MediaSurfaceContractSerializationTest.kt
Valid community ratings are formatted with a star label, a score scaled to 100, and a singular or plural count label. They are appended after external ratings. Tests cover present and absent values.
Community rating accessibility label
android-shared/src/androidMain/kotlin/org/prairieserver/prairie/common/ui/RatingEntry.kt
Community ratings use “Community rating” followed by the display value as the content description. Other ratings retain their existing label format.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CatalogDetailReadV2
  participant ItemDetailReadV2_toDomain
  participant ItemDetail
  participant ExternalRatings_titleRatings
  participant RatingEntry
  CatalogDetailReadV2->>ItemDetailReadV2_toDomain: deserialize community_rating
  ItemDetailReadV2_toDomain->>ItemDetail: pass communityRating
  ItemDetail->>ExternalRatings_titleRatings: request title ratings
  ExternalRatings_titleRatings->>RatingEntry: provide community DisplayRating
Loading

Merge Risk: ⚪ Minimal · up to bc4a4

The community rating appears where intended when available and remains hidden when absent. No actionable issue identified here prevents merging after normal checks.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: displaying the server community rating on phone and TV title pages.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@JonahMMay
JonahMMay merged commit 7041ee8 into main Oct 12, 2026
6 checks passed
@JonahMMay
JonahMMay deleted the feat/community-rating branch October 12, 2026 22:41
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