From fa4060b7fe6f096f82f0b60c8b8916a4ac203bce Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 7 Jan 2020 16:55:13 -0800 Subject: [PATCH] Fixed: Previously imported downloads reappear in queue Fixes #3496 --- .../TrackedDownloadService.cs | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs index 89824958f..92d6a60fa 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs @@ -110,19 +110,27 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do var firstHistoryItem = historyItems.First(); var state = GetStateFromHistory(firstHistoryItem.EventType); + trackedDownload.State = state; + + // TODO: Restore check to confirm all files were imported + // This will treat partially imported downloads as imported (as it was before), which means a partially imported download after a + // restart will get marked as imported without importing the restart of the files. + // One potential issue here is if the latest is imported, but other episodes are ignored or never imported. // It's unlikely that will happen, but could happen if additional episodes are added to season after it's already imported. - - if (state == TrackedDownloadState.Imported) - { - var allImported = _trackedDownloadAlreadyImported.IsImported(trackedDownload, historyItems); - trackedDownload.State = allImported ? TrackedDownloadState.Imported : TrackedDownloadState.Downloading; - } - else - { - trackedDownload.State = state; - } +// if (state == TrackedDownloadState.Imported) +// { +// trackedDownload.State = TrackedDownloadState.Imported; +// +// var allImported = _trackedDownloadAlreadyImported.IsImported(trackedDownload, historyItems); +// +// trackedDownload.State = allImported ? TrackedDownloadState.Imported : TrackedDownloadState.Downloading; +// } +// else +// { +// trackedDownload.State = state; +// } var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == HistoryEventType.Grabbed); trackedDownload.Indexer = grabbedEvent?.Data["indexer"];