From b48ca92675c3099309c36a7e0761ee483f6aa6a9 Mon Sep 17 00:00:00 2001 From: d11n Date: Wed, 2 Oct 2024 01:23:25 +0200 Subject: [PATCH] Fix app stats sorting (#6265) --- BTCPayServer/Services/Apps/AppService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/Services/Apps/AppService.cs b/BTCPayServer/Services/Apps/AppService.cs index b10229a91..1ffa84a58 100644 --- a/BTCPayServer/Services/Apps/AppService.cs +++ b/BTCPayServer/Services/Apps/AppService.cs @@ -106,15 +106,15 @@ namespace BTCPayServer.Services.Apps Date = entities.Key, Label = entities.Key.ToString("MMM dd", CultureInfo.InvariantCulture), SalesCount = entities.Count() - }); + }).ToList(); // fill up the gaps foreach (var i in Enumerable.Range(0, numberOfDays)) { var date = (DateTimeOffset.UtcNow - TimeSpan.FromDays(i)).Date; - if (!series.Any(e => e.Date == date)) + if (series.All(e => e.Date != date)) { - series = series.Append(new AppSalesStatsItem + series.Add(new AppSalesStatsItem { Date = date, Label = date.ToString("MMM dd", CultureInfo.InvariantCulture) @@ -125,7 +125,7 @@ namespace BTCPayServer.Services.Apps return Task.FromResult(new AppSalesStats { SalesCount = series.Sum(i => i.SalesCount), - Series = series.OrderBy(i => i.Label) + Series = series.OrderBy(i => i.Date) }); }