Fixed: Queue count badge showing warning/error incorrectly

pull/3019/head
Mark McDowall 6 years ago
parent 95bb73c5ac
commit db41104d9b

@ -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
};
}
);

@ -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();

@ -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; }
}
}

Loading…
Cancel
Save