Simplify host episode counting code

Use the database to count the episodes.
See https://stackoverflow.com/questions/1656748/how-can-i-fetch-a-single-count-value-from-a-database-with-dbi
for explanation of Perl DBI calls.
This commit is contained in:
2025-11-06 20:52:43 -05:00
parent 192d994556
commit 126e184126
2 changed files with 14 additions and 19 deletions

View File

@@ -17,18 +17,18 @@
'
%-->
<!--% query_hpr_show_count = '
SELECT id
SELECT COUNT(id) as Tally
FROM eps
WHERE eps.hostid = ? AND eps.date < date(\'now\', \'+1 days\')
'
%-->
<!--% query_twt_show_count = DBI.prepare('
SELECT id
<!--% query_twt_show_count = '
SELECT COUNT(id) as Tally
FROM twat_eps AS eps
WHERE eps.hostid = ?
')
'
%-->
<!--% query_twt_shows = DBI.prepare('
<!--% query_twt_shows = '
SELECT
eps.id,
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit ,
@@ -44,6 +44,6 @@
INNER JOIN miniseries ON eps.series = miniseries.id
WHERE hosts.hostid = ?
ORDER BY eps.id DESC
')
'
%-->