feat(filters): pick one year from a decade grid, in the feed and in Plex
A shared YearPicker: the recent years as chips with their counts, and a More dialog that lays every year out by decade (sortable by count), so a ninety-year library fits on one screen. The feed's scrolling popover gives way to it; the Plex rail gets it above its range fields, a pick setting both ends. The Plex facets now count titles per year, the year filter left out.
This commit is contained in:
@@ -105,6 +105,28 @@ def test_the_facets_count_what_the_caller_would_see(db, make_user):
|
||||
assert (theirs["year_min"], mine["year_min"]) == (2001, 1990)
|
||||
|
||||
|
||||
def test_the_facets_count_titles_per_year_without_the_year_filter(db, make_user):
|
||||
# The year picker lists every year with its count. Like each facet it drops its own filter (a
|
||||
# picked year must not empty the list it was picked from) and keeps the others; movies and shows
|
||||
# of one year add up, newest first.
|
||||
me = make_user()
|
||||
movies, shows = _lib(db), _lib(db, "2", kind="show")
|
||||
_movie(db, movies, "a", genres=["Drama"], year=2001)
|
||||
_movie(db, movies, "b", genres=["Drama"], year=2001)
|
||||
_movie(db, movies, "c", genres=["Drama"], year=1990)
|
||||
_movie(db, movies, "d", genres=["Horror"], year=1985)
|
||||
_movie(db, movies, "e", genres=["Drama"]) # no year: not a year to pick
|
||||
db.add(PlexShow(rating_key="s1", library_id=shows.id, title="S", genres=["Drama"], year=1990))
|
||||
db.commit()
|
||||
|
||||
f = LibraryFilters(genres="Drama", year_min=2001, year_max=2001)
|
||||
got = library.facets(db, me, scope="both", show="all", lang="en", f=f)
|
||||
assert got["years"] == [{"year": 2001, "count": 2}, {"year": 1990, "count": 2}]
|
||||
assert (got["year_min"], got["year_max"]) == (1990, 2001)
|
||||
movie_only = library.facets(db, me, scope="movie", show="all", lang="en", f=f)
|
||||
assert movie_only["years"] == [{"year": 2001, "count": 2}, {"year": 1990, "count": 1}]
|
||||
|
||||
|
||||
def test_an_episode_search_joins_the_callers_state(db, make_user):
|
||||
me, other = make_user(), make_user()
|
||||
lib = _lib(db, "2", kind="show")
|
||||
|
||||
Reference in New Issue
Block a user