diff --git a/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs b/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs index fd603ece8..1af86ab1c 100644 --- a/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs +++ b/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs @@ -26,11 +26,15 @@ public CombinedStatistics IndexerStatistics(DateTime start, DateTime end, List indexerIds.Contains(h.IndexerId)); + var filteredHistory = history.Where(h => indexerIds.Contains(h.IndexerId)).ToArray(); - var groupedByIndexer = filteredHistory.GroupBy(h => h.IndexerId); - var groupedByUserAgent = filteredHistory.GroupBy(h => h.Data.GetValueOrDefault("source") ?? ""); - var groupedByHost = filteredHistory.GroupBy(h => h.Data.GetValueOrDefault("host") ?? ""); + var groupedByIndexer = filteredHistory.GroupBy(h => h.IndexerId).ToArray(); + var groupedByUserAgent = filteredHistory + .Where(h => h.EventType != HistoryEventType.IndexerAuth) + .GroupBy(h => h.Data.GetValueOrDefault("source") ?? "").ToArray(); + var groupedByHost = filteredHistory + .Where(h => h.EventType != HistoryEventType.IndexerAuth) + .GroupBy(h => h.Data.GetValueOrDefault("host") ?? "").ToArray(); var indexerStatsList = new List(); var userAgentStatsList = new List(); @@ -60,7 +64,7 @@ public CombinedStatistics IndexerStatistics(DateTime start, DateTime end, List int.TryParse(h.Data.GetValueOrDefault("elapsedTime"), out temp) && h.Data.GetValueOrDefault("cached") != "1") - .Select(h => temp) + .Select(_ => temp) .ToArray(); indexerStats.AverageResponseTime = elapsedTimeEvents.Any() ? (int)elapsedTimeEvents.Average() : 0; @@ -68,6 +72,7 @@ public CombinedStatistics IndexerStatistics(DateTime start, DateTime end, List v.Date) - .ThenBy(v => v.Id) - .ToArray(); + .ThenBy(v => v.Id) + .ToArray(); foreach (var historyEvent in sortedEvents) { @@ -128,13 +131,10 @@ public CombinedStatistics IndexerStatistics(DateTime start, DateTime end, List v.Date) - .ThenBy(v => v.Id) - .ToArray(); + .ThenBy(v => v.Id) + .ToArray(); foreach (var historyEvent in sortedEvents) { @@ -163,8 +163,6 @@ public CombinedStatistics IndexerStatistics(DateTime start, DateTime end, List