forked from rho_n/hpr_generator
Add comment tally to index page
This commit is contained in:
parent
bf60d35ed1
commit
76b976732b
@ -21,19 +21,28 @@
|
||||
<h1>Latest Shows</h1>
|
||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
||||
<!--% 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
|
||||
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
|
||||
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
|
||||
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\')
|
||||
ORDER BY date DESC
|
||||
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>
|
||||
<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) %-->
|
||||
<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>
|
||||
</header>
|
||||
<!--% latest_episodes.notes %-->
|
||||
|
Loading…
Reference in New Issue
Block a user