Add a `views` column to the schedule display

This commit is contained in:
gg1234 2024-04-23 02:17:18 -07:00
parent 4fe3e10656
commit d29801585a
2 changed files with 20 additions and 15 deletions

View File

@ -3,11 +3,12 @@ package WNDB;
sub schedule_default {
my $sql = shift;
my $query = "
SELECT seg.n AS title,
c.n AS caster,
s.video_id AS video_id,
m.val AS mscale,
s.jst AS jst
SELECT seg.n AS title,
c.n AS caster,
s.video_id AS video_id,
m.val AS mscale,
s.view_count AS view_count,
s.jst AS jst
FROM schedule s
JOIN segment seg ON seg.id = s.segment_id
LEFT JOIN caster c ON c.id = s.caster_id
@ -21,11 +22,12 @@ sub schedule_by_caster {
my $caster = shift;
my $query = "
-- list of appearances by caster
SELECT seg.n AS title,
c.n AS caster,
s.video_id AS video_id,
m.val AS mscale,
s.jst AS jst
SELECT seg.n AS title,
c.n AS caster,
s.video_id AS video_id,
m.val AS mscale,
s.view_count AS view_count,
s.jst AS jst
FROM schedule s
JOIN segment seg ON seg.id = s.segment_id
LEFT JOIN caster c ON c.id = s.caster_id
@ -40,11 +42,12 @@ sub schedule_by_segment {
my $segment = shift;
my $query = "
-- list of appearances by caster
SELECT seg.n AS title,
c.n AS caster,
s.video_id AS video_id,
m.val AS mscale,
s.jst AS jst
SELECT seg.n AS title,
c.n AS caster,
s.video_id AS video_id,
m.val AS mscale,
s.view_count AS view_count,
s.jst AS jst
FROM schedule s
JOIN segment seg ON seg.id = s.segment_id
LEFT JOIN caster c ON c.id = s.caster_id

View File

@ -5,6 +5,7 @@
<th>title</th>
<th>caster</th>
<th>links</th>
<th>views</th>
<th>time</th>
</tr>
</thead>
@ -14,6 +15,7 @@
<td class="segment"><a href="segment/?n=<: $i.title | uri :>"><: $i.title :></a></td>
<td class="caster"><a href="caster/?n=<: $i.caster | uri :>"><: $i.caster :></a></td>
<td class="links"><: include "xslate/_links.html" { i => $i } :></td>
<td class="views"><: $i.view_count :></td>
<td class="datetime"><: $i.jst | date_time :></td>
</tr>
: }