Merge pull request '[i282] Add to each correspondent's page the number of comments each postcast has' (#296) from i282_correspondents-page-the-number-of-comments-each-postcast-has into main
Reviewed-on: #296
This commit is contained in:
@@ -3,46 +3,17 @@
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS "queries-correspondent.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
|
||||
%-->
|
||||
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows) %-->
|
||||
<!--% results_hpr_show_count = DBI.prepare(query_hpr_show_count) %-->
|
||||
<!--% hpr_shows_to_count = results_hpr_show_count.execute(id); %-->
|
||||
<!--% hpr_result_status = results_hpr_show_count.execute(id); %-->
|
||||
<!--% hpr_shows = results_hpr_shows.execute(id); %-->
|
||||
<!--% hpr_show_count = 0 %-->
|
||||
<!--% FOREACH show IN hpr_shows_to_count %-->
|
||||
<!--% hpr_show_count = hpr_show_count +1; %-->
|
||||
<!--% END %-->
|
||||
<!--% hpr_show_count = results_hpr_show_count.fetchrow_array %-->
|
||||
|
||||
<!--% query_twt_show_count = DBI.prepare('
|
||||
SELECT id
|
||||
FROM twat_eps AS eps
|
||||
WHERE eps.hostid = ?
|
||||
')
|
||||
%-->
|
||||
<!--% query_twt_shows = DBI.prepare('
|
||||
SELECT
|
||||
eps.id,
|
||||
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit ,
|
||||
eps.date, eps.license, eps.duration,
|
||||
eps.title, eps.summary, eps.tags,
|
||||
eps.notes,
|
||||
hosts.local_image,
|
||||
hosts.hostid,
|
||||
hosts.host, hosts.email, hosts.profile,
|
||||
miniseries.name AS series, miniseries.id AS seriesid
|
||||
FROM twat_eps AS eps
|
||||
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||
WHERE hosts.hostid = ?
|
||||
ORDER BY eps.id DESC
|
||||
')
|
||||
%-->
|
||||
<!--% twt_shows_to_count = query_twt_show_count.execute(id); %-->
|
||||
<!--% twt_shows = query_twt_shows.execute(id); %-->
|
||||
<!--% twt_show_count = 0 %-->
|
||||
<!--% FOREACH show IN twt_shows_to_count %-->
|
||||
<!--% twt_show_count = twt_show_count +1; %-->
|
||||
<!--% END %-->
|
||||
<!--% results_hpr_shows = DBI.prepare(query_twt_shows) %-->
|
||||
<!--% results_twt_show_count = DBI.prepare(query_twt_show_count) %-->
|
||||
<!--% twt_result_status = results_twt_show_count.execute(id); %-->
|
||||
<!--% twt_shows = results_hpr_shows.execute(id); %-->
|
||||
<!--% twt_show_count = results_twt_show_count.fetchrow_array %-->
|
||||
|
||||
<!--% hosts = DBI.tie('hosts', 'hostid') %-->
|
||||
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
<!--% query_hpr_shows = '
|
||||
<!--% query_hpr_shows = 'WITH
|
||||
comment_tallies AS (
|
||||
SELECT
|
||||
eps_id,
|
||||
COUNT(eps_id) AS eps_tally
|
||||
FROM comments
|
||||
GROUP BY eps_id
|
||||
)
|
||||
SELECT
|
||||
eps.id,
|
||||
eps.explicit,
|
||||
@@ -8,17 +15,44 @@
|
||||
hosts.local_image,
|
||||
hosts.hostid,
|
||||
hosts.host, hosts.email, hosts.profile,
|
||||
miniseries.name AS series, miniseries.id AS seriesid
|
||||
miniseries.name AS series, miniseries.id AS seriesid,
|
||||
COALESCE(comment_tallies.eps_tally,0) AS commentsTally
|
||||
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 hosts.hostid = ? AND eps.date < date(\'now\', \'+1 days\')
|
||||
ORDER BY eps.id + 0 DESC
|
||||
'
|
||||
%-->
|
||||
<!--% 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 = '
|
||||
SELECT COUNT(id) as Tally
|
||||
FROM twat_eps AS eps
|
||||
WHERE eps.hostid = ?
|
||||
'
|
||||
%-->
|
||||
<!--% query_twt_shows = '
|
||||
SELECT
|
||||
eps.id,
|
||||
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit ,
|
||||
eps.date, eps.license, eps.duration,
|
||||
eps.title, eps.summary, eps.tags,
|
||||
eps.notes,
|
||||
hosts.local_image,
|
||||
hosts.hostid,
|
||||
hosts.host, hosts.email, hosts.profile,
|
||||
miniseries.name AS series, miniseries.id AS seriesid
|
||||
FROM twat_eps AS eps
|
||||
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||
WHERE hosts.hostid = ?
|
||||
ORDER BY eps.id DESC
|
||||
'
|
||||
%-->
|
||||
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
<!--% query_episodes = 'SELECT
|
||||
<!--% query_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.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
|
||||
miniseries.name AS series, miniseries.id AS seriesid,
|
||||
COALESCE(comment_tallies.eps_tally,0) AS commentsTally
|
||||
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 <= date(\'now\')
|
||||
ORDER BY eps.id + 0 DESC'
|
||||
%-->
|
||||
|
||||
@@ -41,7 +41,7 @@ or
|
||||
<span><label>Flag:</label> <!--% display_explicit(show.explicit) %-->.</span>
|
||||
<span><!--% show_series(show.series, show.seriesid) %--></span> <br>
|
||||
<!--% IF hide_tags == "" %--><!--% display_tags(show.tags) %--><!--% END %-->
|
||||
<!--% IF show.comentsTally || show.commentsTally == 0 %-->
|
||||
<!--% IF show.commentsTally || show.commentsTally == 0 %-->
|
||||
<span><label>Comments:</label> <!--% display_comments_tally(show.id, show.commentsTally) %--></span>
|
||||
<!--% END %-->
|
||||
<!--% END %-->
|
||||
|
||||
Reference in New Issue
Block a user