Skip to content

[BUG] Home screen 'Recent' sort places unstarted (0-progress) seasons in reverse alphabetical order instead of by release date #999

Description

@Aresitoo

Bug Description

On the Home screen (e.g. the "TV Seasons" / In Progress row), when sorting by Recent:

  1. Actively watched media (progress > 0) is sorted descending by watch activity (last_played_at / progressed_at / created_at).
  2. However, for all unstarted items (progress == 0), sort_home_entries() delegates to _sort_numeric(entries, _entry_recent_timestamp, direction).
  3. Because _entry_recent_timestamp returns None for 0-progress items, without_value is sorted via:
    without_value.sort(
        key=lambda entry: _entry_title(entry).lower(), reverse=descending
    )
  4. Since direction is DESC, all unstarted/0-progress items are sorted in reverse alphabetical order (Z -> A) by title.

The Problem

  • An already released, fully available season starting with B (e.g. Bridgerton Season 4, released Jan 2026) gets placed dead last at the very end of the row.
  • Meanwhile, unreleased shows with no release date / TBA (e.g. Witch Hat Atelier Season 2, Frieren Season 3, Elle Season 2) get placed ahead of released shows simply because W, F, E come after B in reverse alphabetical order.

Proposed Fix

In src/users/home_screen.py -> sort_home_entries:
When sort_by == HomeSortChoices.RECENT, sort unstarted items (without_recent) by release status / date rather than raw reverse title:

  1. Already Released (release_date <= now): Newest release first.
  2. Upcoming Confirmed (release_date > now): Soonest upcoming first.
  3. Unscheduled / TBA (release_date is None): At the end of the row, sorted alphabetically.
    if sort_by == HomeSortChoices.RECENT:
        descending = direction == DirectionChoices.DESC
        with_recent = [e for e in entries if _entry_recent_timestamp(e) is not None]
        without_recent = [e for e in entries if _entry_recent_timestamp(e) is None]
        with_recent.sort(key=_entry_recent_timestamp, reverse=descending)

        now = timezone.now()

        def _unstarted_sort_key(entry):
            rd = _entry_release_date(entry.item)
            if rd is not None:
                dt_val = _coerce_datetime(rd)
                if dt_val is not None:
                    ts = dt_val.timestamp()
                    if dt_val <= now:
                        return (0, -ts, _entry_title(entry).lower())
                    else:
                        return (1, ts, _entry_title(entry).lower())
            return (2, 0, _entry_title(entry).lower())

        without_recent.sort(key=_unstarted_sort_key)
        return with_recent + without_recent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions