chore: show year for shows if not watched in last 90 days

This commit is contained in:
Cory Dransfeldt 2024-10-15 19:25:53 -07:00
parent 87ec7993ef
commit 4e5cc4427f
No known key found for this signature in database

View file

@ -19,12 +19,20 @@ SELECT
'url', s.slug, 'url', s.slug,
'alt', CONCAT(s.title, ' (', s.year, ')'), 'alt', CONCAT(s.title, ' (', s.year, ')'),
'subtext', COALESCE( 'subtext', COALESCE(
(SELECT CONCAT('S', e1.season_number, 'E', e1.episode_number) (
SELECT
CASE
WHEN e1.last_watched_at >= NOW() - INTERVAL '90 days' THEN
CONCAT('S', e1.season_number, 'E', e1.episode_number)
ELSE
CONCAT('(', s.year::TEXT, ')')
END
FROM episodes e1 FROM episodes e1
WHERE e1.show = s.id WHERE e1.show = s.id
ORDER BY e1.season_number DESC, e1.episode_number DESC ORDER BY e1.last_watched_at DESC, e1.season_number DESC, e1.episode_number DESC
LIMIT 1), LIMIT 1
s.year::TEXT ),
CONCAT('(', s.year::TEXT, ')')
) )
) AS grid, ) AS grid,