From 2d522a9321bc8eb9048a1e8d3c48d7cadbf54870 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sun, 9 Mar 2025 14:08:57 +0100 Subject: [PATCH] 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 Tested-by: BuildkiteCI --- users/Profpatsch/whatcd-resolver/src/Redacted.hs | 9 ++------- users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/users/Profpatsch/whatcd-resolver/src/Redacted.hs b/users/Profpatsch/whatcd-resolver/src/Redacted.hs index 52149ea4f..402bce298 100644 --- a/users/Profpatsch/whatcd-resolver/src/Redacted.hs +++ b/users/Profpatsch/whatcd-resolver/src/Redacted.hs @@ -620,8 +620,7 @@ getTorrentById dat = do >>= ensureSingleRow data GetBestTorrentsFilter = GetBestTorrentsFilter - { onlyDownloaded :: Bool, - onlyArtist :: Maybe (Label "artistRedactedId" Int), + { onlyArtist :: Maybe (Label "artistRedactedId" Int), onlyTheseTorrents :: Maybe ([Label "torrentId" Int]), limitResults :: Maybe Natural } @@ -640,10 +639,7 @@ getBestTorrents opts = do FROM redacted.torrents WHERE - -- onlyDownloaded - ((NOT ?::bool) OR torrent_file IS NOT NULL) -- filter by artist id - AND (?::bool OR (to_jsonb(?::int) <@ (jsonb_path_query_array(full_json_result, '$.artists[*].id')))) -- filter by torrent ids AND @@ -683,8 +679,7 @@ getBestTorrents opts = do let (onlyTheseTorrentsB, onlyTheseTorrents) = case opts.onlyTheseTorrents of Nothing -> (True, PGArray []) Just a -> (False, a <&> (.torrentId) & PGArray) - ( opts.onlyDownloaded :: Bool, - onlyArtistB :: Bool, + ( onlyArtistB :: Bool, onlyArtistId :: Int, onlyTheseTorrentsB :: Bool, onlyTheseTorrents, diff --git a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs index 5dc30b22f..70e30b02b 100644 --- a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs +++ b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs @@ -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)) let limitResults = getField @"limitResults" opts - let getBest = getBestTorrents GetBestTorrentsFilter {onlyDownloaded = False, ..} + let getBest = getBestTorrents GetBestTorrentsFilter {..} bestStale :: [TorrentData ()] <- getBest (statusInfo, transmissionStatus) <- getAndUpdateTransmissionTorrentsStatus