hpr_generator/templates/queries-index-mysql.tpl.html
Dave Morriss db6c0bedaa Fixed four queries to correct the episode flags
templates/queries-correspondent-mysql.tpl.html,
templates/queries-correspondent-sqlite.tpl.html,
templates/queries-index-mysql.tpl.html,
templates/queries-index-sqlite.tpl.html: All SQL queries used a CASE
    expression to return either 'Explicit' or 'Clean' depending on the
    0/1 setting of the 'explicit' column. However, the TT² templates
    using these queries were written to expect the numeric form. All the
    'CASE' expressions have been replaced by the field name and now the
    correct flag is being displayed.
2024-05-18 15:54:52 +01:00

59 lines
1.4 KiB
HTML

<!--% query_next_available_episode = '
SELECT id, date FROM eps e WHERE id = (
SELECT id + 1 FROM eps mo
WHERE NOT EXISTS (
SELECT NULL
FROM eps mi
WHERE mi.id = mo.id + 1
)
ORDER BY id
LIMIT 1) - 1
'
%-->
<!--% query_latest_episodes = '
WITH comment_tallies AS (
SELECT
eps_id,
COUNT(eps_id) AS eps_tally
FROM comments
GROUP BY eps_id
)
SELECT
eps.id,
eps.explicit,
eps.date, eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
hosts.local_image,
hosts.hostid,
hosts.host, hosts.email,
miniseries.name AS series, miniseries.id AS seriesid,
COALESCE (comment_tallies.eps_tally, 0) AS eps_tally
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
WHERE eps.date <= UTC_DATE()
ORDER BY eps.id DESC
LIMIT 10
'
%-->
<!--% query_last_5_weeks_episodes = '
SELECT
eps.id,
eps.explicit,
eps.date, eps.license, eps.title, eps.summary,
eps.duration, eps.notes, eps.tags,
hosts.hostid,
hosts.host, hosts.email, hosts.local_image,
miniseries.name AS series, miniseries.id AS seriesid
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
WHERE eps.date <= UTC_DATE()
ORDER BY eps.id DESC
LIMIT 30 OFFSET 10
'
%-->