summaryrefslogtreecommitdiff
path: root/routers/films.py
diff options
context:
space:
mode:
authorTyler Hoang <tyler@tylerhoang.xyz>2026-05-09 01:14:57 -0700
committerTyler Hoang <tyler@tylerhoang.xyz>2026-05-09 01:14:57 -0700
commit65466fd5c645e546707ce699b4ea289f894fea20 (patch)
treedebb3768e8d84000a8c32d2df8361bb42a457523 /routers/films.py
parent9f82415366e6220651351007c2dc0ef21df7ff85 (diff)
Auto-select today's date on add form; clean up rewatch history panel
- Default date_watched to today when adding a new film (JS, en-CA locale) - Match rewatch history by tmdb_id when available, fall back to title - Replace inline styles in rewatch section with CSS classes - Simplify redundant Jinja conditions (rewatch_history and, loop.length > 1) - Move review-panel margin-top hack to .review-panel-spaced class Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'routers/films.py')
-rw-r--r--routers/films.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/films.py b/routers/films.py
index c85d811..333eaef 100644
--- a/routers/films.py
+++ b/routers/films.py
@@ -444,9 +444,12 @@ async def film_detail(film_id: int, request: Request, db: Session = Depends(get_
film = _get_film_or_404(db, film_id)
tmdb_context = await _film_tmdb_context(film)
+ rewatch_filter = (
+ Film.tmdb_id == film.tmdb_id if film.tmdb_id is not None else Film.title == film.title
+ )
rewatch_history = (
db.query(Film)
- .filter(Film.title == film.title, Film.shelf == "diary")
+ .filter(rewatch_filter, Film.shelf == "diary")
.order_by(Film.date_watched.asc())
.all()
)