From 364634151d756ce28060e9a982019e7f7bdb17cc Mon Sep 17 00:00:00 2001 From: Tyler Hoang Date: Thu, 7 May 2026 00:21:24 -0700 Subject: Add rewatch history to film detail page Display all watches for a film with dates, ratings, and companions. Show time elapsed between rewatches and highlight when rating changed. Co-Authored-By: Claude Haiku 4.5 --- routers/films.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'routers/films.py') diff --git a/routers/films.py b/routers/films.py index e432a5c..c85d811 100644 --- a/routers/films.py +++ b/routers/films.py @@ -443,10 +443,24 @@ def get_films_partial( async def film_detail(film_id: int, request: Request, db: Session = Depends(get_db)): film = _get_film_or_404(db, film_id) tmdb_context = await _film_tmdb_context(film) + + rewatch_history = ( + db.query(Film) + .filter(Film.title == film.title, Film.shelf == "diary") + .order_by(Film.date_watched.asc()) + .all() + ) + return templates.TemplateResponse( request=request, name="detail.html", - context={"request": request, "film": film, "active_shelf": film.shelf, "tmdb_context": tmdb_context}, + context={ + "request": request, + "film": film, + "active_shelf": film.shelf, + "tmdb_context": tmdb_context, + "rewatch_history": rewatch_history, + }, ) -- cgit v1.3-2-g0d8e