mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 07:04:26 +01:00
Fix app stats sorting (#6265)
This commit is contained in:
@@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user