forked from rho_n/hpr_generator
Add comment tally to index page
This commit is contained in:
parent
bf60d35ed1
commit
76b976732b
@ -21,6 +21,13 @@
|
|||||||
<h1>Latest Shows</h1>
|
<h1>Latest Shows</h1>
|
||||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
||||||
<!--% FOREACH latest_episodes IN DBI.query('
|
<!--% FOREACH latest_episodes IN DBI.query('
|
||||||
|
WITH comment_tallies AS (
|
||||||
|
SELECT
|
||||||
|
eps_id,
|
||||||
|
COUNT(eps_id) AS eps_tally
|
||||||
|
FROM comments
|
||||||
|
GROUP BY eps_id
|
||||||
|
)
|
||||||
SELECT
|
SELECT
|
||||||
eps.id,
|
eps.id,
|
||||||
eps.explicit,
|
eps.explicit,
|
||||||
@ -30,10 +37,12 @@
|
|||||||
hosts.local_image,
|
hosts.local_image,
|
||||||
hosts.hostid,
|
hosts.hostid,
|
||||||
hosts.host, hosts.email,
|
hosts.host, hosts.email,
|
||||||
miniseries.name AS series, miniseries.id AS seriesid
|
miniseries.name AS series, miniseries.id AS seriesid,
|
||||||
|
COALESCE (comment_tallies.eps_tally, 0) AS eps_tally
|
||||||
FROM eps
|
FROM eps
|
||||||
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||||
INNER JOIN miniseries ON eps.series = miniseries.id
|
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||||
|
LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
|
||||||
WHERE eps.date < date(\'now\', \'+1 days\')
|
WHERE eps.date < date(\'now\', \'+1 days\')
|
||||||
ORDER BY date DESC
|
ORDER BY date DESC
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
@ -49,7 +58,7 @@
|
|||||||
<br>Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% display_explicit(latest_episodes.explicit) %--> and released under a <!--% latest_episodes.license %--> license. <br>
|
<br>Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% display_explicit(latest_episodes.explicit) %--> and released under a <!--% latest_episodes.license %--> license. <br>
|
||||||
<strong>Tags:</strong> <!--% latest_episodes.tags %--><em></em>.<br>
|
<strong>Tags:</strong> <!--% latest_episodes.tags %--><em></em>.<br>
|
||||||
<small>listen in <a href="local/hpr<!--% latest_episodes.id %-->.ogg">ogg</a>, <a href="local/hpr<!--% latest_episodes.id %-->.spx">spx</a>, or <a href="local/hpr<!--% latest_episodes.id %-->.mp3">mp3</a> format. <!--% show_series(latest_episodes.series, latest_episodes.seriesid) %-->
|
<small>listen in <a href="local/hpr<!--% latest_episodes.id %-->.ogg">ogg</a>, <a href="local/hpr<!--% latest_episodes.id %-->.spx">spx</a>, or <a href="local/hpr<!--% latest_episodes.id %-->.mp3">mp3</a> format. <!--% show_series(latest_episodes.series, latest_episodes.seriesid) %-->
|
||||||
<a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html#comments">View comments.</a></small>
|
<a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html#comments">Comments (<!--% latest_episodes.eps_tally %-->)</a>.</small>
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
<!--% latest_episodes.notes %-->
|
<!--% latest_episodes.notes %-->
|
||||||
|
Loading…
Reference in New Issue
Block a user