Skip to content

Commit

Permalink
Publication/YoutubeUploaders -> add a section that simply lists publi…
Browse files Browse the repository at this point in the history
…cations without a TVA encode
  • Loading branch information
adelikat committed Sep 22, 2024
1 parent a0ca489 commit 51737c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions TASVideos/Pages/Publications/YoutubeUploaders.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,25 @@
var tvcData = groups.Single(g => g.Key == tvc);
}

<h4>Non-Obsolete Pubs Without a TASVideosChannel Encode</h4>
<standard-table>
<table-head columns="Publication, Channel"></table-head>
@foreach(var channel in Model.Videos.Where(v => !v.IsObsolete).Where(v => v.ChannelTitle != tvc).OrderByDescending(v => v.PublicationId))
{
<tr>
<td><pub-link id="@channel.PublicationId">@channel.PublicationTitle</pub-link></td>
<td>@channel.ChannelTitle</td>
</tr>
}
</standard-table>

<h4>@tvc</h4>
<label>Current: @tvcData.Count(d => !d.IsObsolete)</label>
<br />
<label>Obsolete: @tvcData.Count(d => d.IsObsolete)</label>
<br />
<br />
<h4>Non-TVA channels linked on Publications</h4>
<standard-table>
<table-head columns="Youtube Channel,Current Uploads,Obsolete Uploads"></table-head>
@foreach (var channel in groups.Where(g => g.Key != tvc))
Expand Down
5 changes: 3 additions & 2 deletions TASVideos/Pages/Publications/YoutubeUploaders.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ public async Task OnGet()
{
u.Url,
u.PublicationId,
u.Publication!.Title,
IsObsolete = u.Publication!.ObsoletedById.HasValue
})
.ToListAsync();

Videos = raw
.Where(r => youtubeSync.IsYoutubeUrl(r.Url))
.Select(u => new YoutubeEntry(u.PublicationId, youtubeSync.VideoId(u.Url!), u.IsObsolete))
.Select(u => new YoutubeEntry(u.PublicationId, u.Title, youtubeSync.VideoId(u.Url!), u.IsObsolete))
.Distinct()
.ToList();

Expand Down Expand Up @@ -61,7 +62,7 @@ private void SetChannelTitlesFromCache(IEnumerable<YoutubeEntry> records)
}
}

public record YoutubeEntry(int PublicationId, string VideoId, bool IsObsolete)
public record YoutubeEntry(int PublicationId, string PublicationTitle, string VideoId, bool IsObsolete)
{
public string ChannelTitle { get; set; } = "";
}
Expand Down

0 comments on commit 51737c2

Please sign in to comment.