Reorder conditions

This commit is contained in:
Ben Adrian Sarmiento
2024-06-23 22:30:46 +02:00
parent 3abf48514d
commit a0c13af94b

View File

@@ -525,14 +525,13 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection []string)
return nil, fmt.Errorf("non-OK state: %s", info.Status) return nil, fmt.Errorf("non-OK state: %s", info.Status)
} }
// check if incorrect number of links if info.Progress != 100 {
if info.Progress == 100 && len(info.Links) != len(selection) { t.repairLog.Infof("Downloading torrent %s (id=%s, progress=%d)", t.GetKey(torrent), info.ID, info.Progress)
} else if info.Progress == 100 && len(info.Links) == len(selection) {
t.repairLog.Infof("Downloaded %d file(s) of torrent %s (id=%s)", len(selection), t.GetKey(torrent), info.ID)
} else if info.Progress == 100 && len(info.Links) != len(selection) {
t.DeleteByID(newTorrentID) t.DeleteByID(newTorrentID)
return nil, fmt.Errorf("only got %d links but we need %d", len(info.Links), len(selection)) return nil, fmt.Errorf("only got %d links but we need %d", len(info.Links), len(selection))
} else if info.Progress != 100 {
t.repairLog.Infof("Downloading torrent %s (id=%s, progress=%d)", t.GetKey(torrent), info.ID, info.Progress)
} else {
t.repairLog.Infof("Downloaded %d file(s) of torrent %s (id=%s)", len(selection), t.GetKey(torrent), info.ID)
} }
return info, nil return info, nil