chore(users/Profpatsch/whatcd-resolver): remove onlyDownloaded

It was unused.

Change-Id: Ib5fa9bf9b97fb5635161dfa2fbed3bf05cc5a585
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13224
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
This commit is contained in:
Profpatsch 2025-03-09 14:08:57 +01:00
parent cf80c75a69
commit 2d522a9321
2 changed files with 3 additions and 8 deletions

View file

@ -620,8 +620,7 @@ getTorrentById dat = do
>>= ensureSingleRow >>= ensureSingleRow
data GetBestTorrentsFilter = GetBestTorrentsFilter data GetBestTorrentsFilter = GetBestTorrentsFilter
{ onlyDownloaded :: Bool, { onlyArtist :: Maybe (Label "artistRedactedId" Int),
onlyArtist :: Maybe (Label "artistRedactedId" Int),
onlyTheseTorrents :: Maybe ([Label "torrentId" Int]), onlyTheseTorrents :: Maybe ([Label "torrentId" Int]),
limitResults :: Maybe Natural limitResults :: Maybe Natural
} }
@ -640,10 +639,7 @@ getBestTorrents opts = do
FROM FROM
redacted.torrents redacted.torrents
WHERE WHERE
-- onlyDownloaded
((NOT ?::bool) OR torrent_file IS NOT NULL)
-- filter by artist id -- filter by artist id
AND
(?::bool OR (to_jsonb(?::int) <@ (jsonb_path_query_array(full_json_result, '$.artists[*].id')))) (?::bool OR (to_jsonb(?::int) <@ (jsonb_path_query_array(full_json_result, '$.artists[*].id'))))
-- filter by torrent ids -- filter by torrent ids
AND AND
@ -683,8 +679,7 @@ getBestTorrents opts = do
let (onlyTheseTorrentsB, onlyTheseTorrents) = case opts.onlyTheseTorrents of let (onlyTheseTorrentsB, onlyTheseTorrents) = case opts.onlyTheseTorrents of
Nothing -> (True, PGArray []) Nothing -> (True, PGArray [])
Just a -> (False, a <&> (.torrentId) & PGArray) Just a -> (False, a <&> (.torrentId) & PGArray)
( opts.onlyDownloaded :: Bool, ( onlyArtistB :: Bool,
onlyArtistB :: Bool,
onlyArtistId :: Int, onlyArtistId :: Int,
onlyTheseTorrentsB :: Bool, onlyTheseTorrentsB :: Bool,
onlyTheseTorrents, onlyTheseTorrents,

View file

@ -846,7 +846,7 @@ getBestTorrentsData opts filters = inSpan' "get torrents table data" $ \span ->
onlyTheseTorrents & doIfJust (\a -> addAttribute span "torrent-filter.ids" (a <&> (getLabel @"torrentId") & showToText & Otel.toAttribute)) onlyTheseTorrents & doIfJust (\a -> addAttribute span "torrent-filter.ids" (a <&> (getLabel @"torrentId") & showToText & Otel.toAttribute))
let limitResults = getField @"limitResults" opts let limitResults = getField @"limitResults" opts
let getBest = getBestTorrents GetBestTorrentsFilter {onlyDownloaded = False, ..} let getBest = getBestTorrents GetBestTorrentsFilter {..}
bestStale :: [TorrentData ()] <- getBest bestStale :: [TorrentData ()] <- getBest
(statusInfo, transmissionStatus) <- (statusInfo, transmissionStatus) <-
getAndUpdateTransmissionTorrentsStatus getAndUpdateTransmissionTorrentsStatus