fix(users/Profpatsch/whatcd-resolver): prefer downloaded torrents

I changed the seeding weight, so now it would not show already
downloaded torrents, prompting me to fetch stuff that I already have
in new qualities. Obviously, that’s not the best idea.

Kinda surprised it’s this easy to fix heh.

Change-Id: I6bbf325672a91d794d144c006ccf3d702a581bce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12330
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2024-08-24 14:06:03 +02:00
parent 9e2ecf9101
commit 95640e7be4

View file

@ -413,7 +413,11 @@ getBestTorrents opts = do
-- filter by artist id -- filter by artist id
AND 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'))))
ORDER BY torrent_group, seeding_weight DESC ORDER BY
torrent_group,
-- prefer torrents which we already downloaded
torrent_file,
seeding_weight DESC
) )
SELECT SELECT
tg.group_id, tg.group_id,