From db41104d9b2f58480d9b918f94e9b0a8ae74b160 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 22 Mar 2019 19:15:58 -0700 Subject: [PATCH] Fixed: Queue count badge showing warning/error incorrectly --- .../src/Activity/Queue/Status/QueueStatusConnector.js | 9 ++++++++- src/Sonarr.Api.V3/Queue/QueueStatusModule.cs | 9 ++++++--- src/Sonarr.Api.V3/Queue/QueueStatusResource.cs | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/Activity/Queue/Status/QueueStatusConnector.js b/frontend/src/Activity/Queue/Status/QueueStatusConnector.js index 0f6c9159d..0959ba0a2 100644 --- a/frontend/src/Activity/Queue/Status/QueueStatusConnector.js +++ b/frontend/src/Activity/Queue/Status/QueueStatusConnector.js @@ -12,7 +12,12 @@ function createMapStateToProps() { (state) => state.queue.options.includeUnknownSeriesItems, (app, status, includeUnknownSeriesItems) => { const { + errors, + warnings, + unknownErrors, + unknownWarnings, count, + totalCount, unknownCount } = status.item; @@ -21,7 +26,9 @@ function createMapStateToProps() { isReconnecting: app.isReconnecting, isPopulated: status.isPopulated, ...status.item, - count: includeUnknownSeriesItems ? count : count - unknownCount + count: includeUnknownSeriesItems ? totalCount : count, + errors: includeUnknownSeriesItems ? errors || unknownErrors : errors, + warnings: includeUnknownSeriesItems ? warnings || unknownWarnings : warnings }; } ); diff --git a/src/Sonarr.Api.V3/Queue/QueueStatusModule.cs b/src/Sonarr.Api.V3/Queue/QueueStatusModule.cs index 9720884be..3417e5c55 100644 --- a/src/Sonarr.Api.V3/Queue/QueueStatusModule.cs +++ b/src/Sonarr.Api.V3/Queue/QueueStatusModule.cs @@ -46,10 +46,13 @@ namespace Sonarr.Api.V3.Queue var resource = new QueueStatusResource { - Count = queue.Count + pending.Count, + TotalCount = queue.Count + pending.Count, + Count = queue.Count(q => q.Series != null) + pending.Count, UnknownCount = queue.Count(q => q.Series == null), - Errors = queue.Any(q => q.TrackedDownloadStatus.Equals("Error", StringComparison.InvariantCultureIgnoreCase)), - Warnings = queue.Any(q => q.TrackedDownloadStatus.Equals("Warning", StringComparison.InvariantCultureIgnoreCase)) + Errors = queue.Any(q => q.Series != null && q.TrackedDownloadStatus.Equals("Error", StringComparison.InvariantCultureIgnoreCase)), + Warnings = queue.Any(q => q.Series != null && q.TrackedDownloadStatus.Equals("Warning", StringComparison.InvariantCultureIgnoreCase)), + UnknownErrors = queue.Any(q => q.Series == null && q.TrackedDownloadStatus.Equals("Error", StringComparison.InvariantCultureIgnoreCase)), + UnknownWarnings = queue.Any(q => q.Series == null && q.TrackedDownloadStatus.Equals("Warning", StringComparison.InvariantCultureIgnoreCase)) }; _broadcastDebounce.Resume(); diff --git a/src/Sonarr.Api.V3/Queue/QueueStatusResource.cs b/src/Sonarr.Api.V3/Queue/QueueStatusResource.cs index 77ec0c804..345fc57c4 100644 --- a/src/Sonarr.Api.V3/Queue/QueueStatusResource.cs +++ b/src/Sonarr.Api.V3/Queue/QueueStatusResource.cs @@ -4,9 +4,12 @@ namespace Sonarr.Api.V3.Queue { public class QueueStatusResource : RestResource { + public int TotalCount { get; set; } public int Count { get; set; } public int UnknownCount { get; set; } public bool Errors { get; set; } public bool Warnings { get; set; } + public bool UnknownErrors { get; set; } + public bool UnknownWarnings { get; set; } } }