[Enhancement] Add media count to sources page (#251)

* [WIP] Got query kinda working, now to refactor other queries

* Refactored all query methods to use dynamic snippets

* Refactored tab layout to grab tabs by name

* Removed standalone show buttons from in-app tables

* Removed unneeded comment
This commit is contained in:
Kieran
2024-05-21 08:53:22 -07:00
committed by GitHub
parent 94c0cf9970
commit a2a0f48065
28 changed files with 219 additions and 242 deletions
@@ -26,7 +26,7 @@ defmodule PinchflatWeb.Pages.PageController do
source_count: Repo.aggregate(Source, :count, :id),
media_item_count:
MediaQuery.new()
|> MediaQuery.with_media_downloaded_at()
|> where(^MediaQuery.downloaded())
|> Repo.aggregate(:count, :id)
)
end
@@ -97,7 +97,8 @@ defmodule Pinchflat.Pages.HistoryTableLive do
defp generate_base_query do
MediaQuery.new()
|> MediaQuery.where_pending_or_downloaded()
|> MediaQuery.require_assoc(:media_profile)
|> where(^dynamic(^MediaQuery.downloaded() or ^MediaQuery.pending()))
|> order_by(desc: :id)
end