Fixed: Manual import for unknown series items will properly mark as imported

Fixes: #277
(cherry picked from commit 3ffcf114682f9b1730f54706ecbf1bf237206bb1)
This commit is contained in:
Mark McDowall
2020-05-24 10:11:10 -07:00
committed by ta264
parent 842f80d567
commit 95d93dfa09
6 changed files with 39 additions and 15 deletions
@@ -130,7 +130,11 @@ namespace NzbDrone.Core.Download
if (allItemsImported)
{
trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
var importedAuthorId = importResults.Where(x => x.Result == ImportResultType.Imported)
.Select(c => c.ImportDecision.Item.Author.Id)
.MostCommon();
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteBook?.Author.Id ?? importedAuthorId));
return true;
}
@@ -153,7 +157,11 @@ namespace NzbDrone.Core.Download
if (allEpisodesImportedInHistory)
{
trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
var importedAuthorId = historyItems.Where(x => x.EventType == EntityHistoryEventType.BookFileImported)
.Select(x => x.AuthorId)
.MostCommon();
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteBook?.Author.Id ?? importedAuthorId));
return true;
}
}