Skip to content

fix: hide stale mid-season episode tags and surface type in details#155

Open
vladjerca wants to merge 4 commits into
mainfrom
fix/mid-season-tag-staleness
Open

fix: hide stale mid-season episode tags and surface type in details#155
vladjerca wants to merge 4 commits into
mainfrom
fix/mid-season-tag-staleness

Conversation

@vladjerca
Copy link
Copy Markdown
Contributor

Summary

Mirrors trakt-web#2367 on Android (app + tv modules).

  • Mid-season finale/premiere chips on up-next cards now drop off once a newer episode has aired. Real series/season finales+premieres still always tag (unchanged). Upcoming/calendar surfaces are untouched - those episodes are by definition the latest aired or future.
  • The episode details meta info gets a new "Type" row that surfaces the exact variant (Series Finale, Season Finale, Mid-Season Finale, etc.), so the full metadata is one tap away even when the card chip is generic or hidden.

Staleness is derived from the show progress endpoint's last_episode: an episode is considered the latest aired if it is >= last_episode by (season, number), via the existing SeasonEpisode.id ordering.

Test plan

  • Show with a mid-season finale as the user's up-next episode renders the "Finale" chip.
  • Same show, after a newer episode airs, no longer renders the chip.
  • Series/season finales+premieres still render their chip on up-next cards.
  • Upcoming/calendar episodes that are mid-season finales+premieres still render the chip.
  • Episode details meta info shows a "Type" row with the exact variant for all 6 finale/premiere variants.
  • Standard episodes do not show a "Type" row.
  • Same checks on the TV (Android TV) module.

vladjerca added 2 commits May 18, 2026 17:36
Mid-season finale and premiere tags previously stuck around past the
mid-season cut. Once a newer episode aired they stopped being
actionable but still read as "Finale" / "Premiere" on the up-next
surfaces, making it look like the show had ended.

Gate the tag on whether the episode is the latest aired episode of
the show, derived from the progress endpoint's `last_episode`. Series
and season finales / premieres are unaffected.

Refs trakt-web#2367
The episode tag on cards intentionally collapses series/season/mid-season
finales and premieres into a single "Finale" / "Premiere" label so the
card UI stays minimal. The exact variant (mid-season finale, season
premiere, etc.) was not surfaced anywhere on the client, so users had no
way to recover the full metadata once the tag was generic or hidden.

Add a new "Type" row to the episode details meta info that renders the
specific variant via a new `episodeTypeStringRes` helper on `Episode`.
Six new string resources cover the finale / premiere variants.

Refs trakt-web#2367
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the display of episode status tags on up-next cards by introducing conditional logic to hide stale mid-season tags. It also improves metadata transparency by surfacing the specific episode type in the details view, ensuring users have access to full context even when card-level tags are suppressed.

Highlights

  • Conditional Tag Visibility: Mid-season premiere and finale chips on up-next cards are now hidden once a newer episode has aired, while series and season-level tags remain persistent.
  • Episode Metadata Expansion: Added a new 'Type' row in episode details to explicitly display the variant (e.g., Series Finale, Mid-Season Premiere) for better metadata visibility.
  • Staleness Logic: Introduced isLatestAired tracking in the progress model to determine if an episode is the most recent, allowing for smarter UI rendering.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces specific episode type tracking (e.g., mid-season finales) and an isLatestAired flag to manage tag visibility in the 'Up Next' sections. It includes a new utility for comparing episode IDs, updates the Episode model with resource mapping, and adds a 'Type' field to the episode details UI. Feedback highlights potential issues with the monotonic ID assumption for special episodes and suggests using enums instead of string-based checks for better maintainability.

Comment thread common/src/main/java/tv/trakt/trakt/common/model/IsLatestAiredEpisode.kt Outdated
Comment thread common/src/main/java/tv/trakt/trakt/common/model/Episode.kt
vladjerca added 2 commits May 18, 2026 19:45
Mirrors the web reference implementation and removes reliance on
`SeasonEpisode.id`'s `season * 10_000` packing, which would silently
break for any season with >= 10000 episodes (impossible in practice,
but the tuple compare is clearer and matches the source PR).
progress.last_episode is the user's furthest watched episode, not the
show's latest aired episode. Comparing next_episode against it is
effectively always true (next is the first unwatched after last_watched
by definition), so the previous gate never actually hid a stale tag.

As a proxy, treat the next episode as the latest aired when the
remaining count (aired - completed) is 1 or less - meaning no further
aired episode exists beyond the displayed one. Drops the
isLatestAiredEpisode helper, with a FIXME to replace once the API
exposes an absolute "latest aired episode" reference.
@vladjerca
Copy link
Copy Markdown
Contributor Author

NOTE: Tyson flagged on the iOS mirror (trakt-apple-internal#126) that the gate this PR introduces is a no-op - progress.last_episode is the user's furthest watched episode, not the show's latest aired episode, so next >= last is always true.

Pushed an interim fix: derive isLatestAired from the remaining count (aired - completed <= 1) so we hide the tag when at least one further aired episode exists beyond the displayed one. FIXME left in the code to swap to an absolute latest-aired-episode reference once the API surfaces one. Same fix queued on trakt-web#2377.

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.

2 participants