1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Queue count badge showing warning/error incorrectly

This commit is contained in:
Mark McDowall 2019-03-22 19:15:58 -07:00
parent 95bb73c5ac
commit db41104d9b
3 changed files with 17 additions and 4 deletions

View File

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

View File

@ -46,10 +46,13 @@ private QueueStatusResource GetQueueStatus()
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();

View File

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