[Housekeeping] Store the upload event as a datetime rather than a date (#269)
* [WIP] renamed and migrated upload_date column * Refactored yt-dlp media module * Refactored parse_upload_date * Refactored media item upload_date_index * Got media tests running * Refactored media item table live * Cleaned up the stragglers * Fixed old oversight re: original_url
This commit is contained in:
@@ -50,7 +50,7 @@ defmodule Pinchflat.Sources.MediaItemTableLive do
|
||||
</.subtle_link>
|
||||
</:col>
|
||||
<:col :let={media_item} label="Upload Date">
|
||||
<%= media_item.upload_date %>
|
||||
<%= DateTime.to_date(media_item.uploaded_at) %>
|
||||
</:col>
|
||||
<:col :let={media_item} :if={@media_state == "other"} label="Manually Ignored?">
|
||||
<.icon name={if media_item.prevent_download, do: "hero-check", else: "hero-x-mark"} />
|
||||
@@ -150,14 +150,14 @@ defmodule Pinchflat.Sources.MediaItemTableLive do
|
||||
|> MediaQuery.require_assoc(:media_profile)
|
||||
|> MediaQuery.require_assoc(:media_items_search_index)
|
||||
|> where(^dynamic(^MediaQuery.for_source(source) and ^MediaQuery.pending()))
|
||||
|> order_by(desc: fragment("rank"), desc: :upload_date)
|
||||
|> order_by(desc: fragment("rank"), desc: :uploaded_at)
|
||||
end
|
||||
|
||||
defp generate_base_query(source, "downloaded") do
|
||||
MediaQuery.new()
|
||||
|> MediaQuery.require_assoc(:media_items_search_index)
|
||||
|> where(^dynamic(^MediaQuery.for_source(source) and ^MediaQuery.downloaded()))
|
||||
|> order_by(desc: fragment("rank"), desc: :upload_date)
|
||||
|> order_by(desc: fragment("rank"), desc: :uploaded_at)
|
||||
end
|
||||
|
||||
defp generate_base_query(source, "other") do
|
||||
@@ -170,7 +170,7 @@ defmodule Pinchflat.Sources.MediaItemTableLive do
|
||||
(not (^MediaQuery.downloaded()) and not (^MediaQuery.pending()))
|
||||
)
|
||||
)
|
||||
|> order_by(desc: fragment("rank"), desc: :upload_date)
|
||||
|> order_by(desc: fragment("rank"), desc: :uploaded_at)
|
||||
end
|
||||
|
||||
defp filter_base_query(base_query, search_term) do
|
||||
|
||||
Reference in New Issue
Block a user