fix(api): a vanished grab takes no headline

Superseding an import failure with any non-failed grab let a 'vanished'
one take the headline: the torrent has left Transmission, so the season
would show neither the failure nor any progress while the gap is still
there.
This commit is contained in:
Miguel Palhas
2026-08-26 12:55:52 +01:00
parent 42c1cd4dce
commit 46554cfc75
2 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -1705,7 +1705,11 @@ async fn season_import_failures(
SELECT 1 FROM grabs newer
WHERE newer.target_kind = 'season'
AND newer.target_id = g.target_id
AND newer.state != 'failed'
-- 'vanished' is not a live attempt either: the
-- torrent left Transmission, so letting it take the
-- headline would leave the season saying nothing at
-- all about a gap that still exists.
AND newer.state NOT IN ('failed', 'vanished')
AND (newer.grabbed_at > coalesce(g.failed_at, g.grabbed_at)
OR (newer.grabbed_at = coalesce(g.failed_at, g.grabbed_at)
AND newer.id > g.id))