Fixed channel open projects count

This commit is contained in:
Gregory Ballantine 2023-03-07 11:54:20 -05:00
parent a9c4b29935
commit 0d854b026a
3 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ class Channel < Sequel::Model
end
def openProjects()
return 0
return self.videos_dataset.exclude(status: 'published').exclude(archived: true).all()
end
end

View File

@ -20,7 +20,7 @@
<p><span><%= channel.directory_path %></span></p>
</div>
<div class="channel-open">
<p>Open projects: <span><%= channel.openProjects() %></span></p>
<p>Open projects: <span><%= channel.openProjects().length %></span></p>
</div>
<div class="channel-videos">
<p>Total videos: <span><%= channel.videos.length %></span></p>

View File

@ -42,7 +42,7 @@
<% channels.each do |c| %>
<tr>
<td><a href="/channel/<%= c.id %>"><%= c.name %></a></td>
<td><%= nullable(c.openProjects) %></td>
<td><%= nullable(c.openProjects().length) %></td>
<td><%= nullable(c.videos.length) %></td>
<td><%= date_format(c.updated_at) %></td>
</tr>