[Enhancement] Add history table to homepage (And TZ support) (#229)

* Added basic history table to homepage

* Improved homepage history query

* Set table to use 24h time

* Added timezone support

* Updated README to reflect new TZ stuff
This commit is contained in:
Kieran
2024-05-07 12:16:57 -07:00
committed by GitHub
parent 1b7fb6d14b
commit a1a568b7f7
10 changed files with 165 additions and 7 deletions
@@ -1,10 +1,9 @@
defmodule PinchflatWeb.Pages.PageController do
alias Pinchflat.Media.MediaItem
use PinchflatWeb, :controller
alias Pinchflat.Repo
alias Pinchflat.Sources.Source
alias Pinchflat.Media.MediaItem
alias Pinchflat.Media.MediaQuery
alias Pinchflat.Profiles.MediaProfile
def home(conn, params) do
@@ -25,7 +24,10 @@ defmodule PinchflatWeb.Pages.PageController do
|> render(:home,
media_profile_count: Repo.aggregate(MediaProfile, :count, :id),
source_count: Repo.aggregate(Source, :count, :id),
media_item_count: Repo.aggregate(MediaItem, :count, :id)
media_item_count:
MediaQuery.new()
|> MediaQuery.with_media_downloaded_at()
|> Repo.aggregate(:count, :id)
)
end