From 8860f5687c98d6b7d6bda6e090a8b07d70322285 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Apr 2026 16:15:46 +0200 Subject: [PATCH 01/21] Fix chart display: dati orari come metrica di partenza + update home --- MP.Data/Services/Utils/StatsAggrService.cs | 21 +++++++++++--------- MP.IOC/Components/Pages/CallStats.razor | 4 ++-- MP.IOC/Components/Pages/CallStats.razor.cs | 23 ++++++++++++++-------- MP.IOC/Components/Pages/Index.razor | 14 ++++++------- MP.IOC/Components/Pages/Index.razor.cs | 2 +- MP.IOC/MP.IOC.csproj | 2 +- MP.IOC/Resources/ChangeLog.html | 2 +- MP.IOC/Resources/VersNum.txt | 2 +- MP.IOC/Resources/manifest.xml | 2 +- 9 files changed, 41 insertions(+), 31 deletions(-) diff --git a/MP.Data/Services/Utils/StatsAggrService.cs b/MP.Data/Services/Utils/StatsAggrService.cs index f0a9f0c7..cadf72cf 100644 --- a/MP.Data/Services/Utils/StatsAggrService.cs +++ b/MP.Data/Services/Utils/StatsAggrService.cs @@ -104,7 +104,8 @@ namespace MP.Data.Services.Utils }) .ToList() }) - .OrderBy(s => s.SeriesName) + //.OrderByDescending(c => c.DataPoints.Sum(x => x.y)) + //.OrderBy(s => s.SeriesName) .ToList(); } else @@ -162,13 +163,14 @@ namespace MP.Data.Services.Utils { Dictionary> result = new(); DateTime oggi = DateTime.Today; - var rawData = await GetFiltAsync(oggi.AddDays(-7), oggi); + int numDays = 7; + var rawData = await GetFiltAsync(oggi.AddDays(-numDays), oggi); // calcolo le varie statistiche... var pDestRequest = rawData.GroupBy(x => x.Destination) .Select(g => new StatDataDTO { Label = g.Key, - Value = g.Sum(x => x.RequestCount) + Value = g.Sum(x => x.RequestCount) / numDays }) .OrderByDescending(x => x.Value) .ToList(); @@ -178,7 +180,7 @@ namespace MP.Data.Services.Utils .Select(g => new StatDataDTO { Label = g.Key, - Value = g.Sum(x => x.RequestCount * x.AvgDuration) + Value = g.Sum(x => x.RequestCount * x.AvgDuration) / numDays }) .OrderByDescending(x => x.Value) .ToList(); @@ -189,16 +191,17 @@ namespace MP.Data.Services.Utils protected async Task>> GetParetoMaccAsync(int numDay) { - numDay = numDay > 1 ? numDay : 1; Dictionary> result = new(); - DateTime oggi = DateTime.Today; - var rawData = await GetFiltAsync(oggi.AddDays(-numDay), oggi); + DateTime adesso = DateTime.Now; + DateTime start = DateTime.Today.AddDays(-numDay); + var rawData = await GetFiltAsync(start, adesso); + var numHour = adesso.Subtract(start).TotalHours; // calcolo le varie statistiche... var pDestRequest = rawData.GroupBy(x => x.MachineId) .Select(g => new StatDataDTO { Label = g.Key, - Value = g.Sum(x => x.RequestCount) / numDay + Value = g.Sum(x => x.RequestCount) / numHour }) .OrderByDescending(x => x.Value) .ToList(); @@ -208,7 +211,7 @@ namespace MP.Data.Services.Utils .Select(g => new StatDataDTO { Label = g.Key, - Value = g.Sum(x => x.RequestCount * x.AvgDuration) / numDay + Value = g.Sum(x => x.RequestCount * x.AvgDuration) / numHour }) .OrderByDescending(x => x.Value) .ToList(); diff --git a/MP.IOC/Components/Pages/CallStats.razor b/MP.IOC/Components/Pages/CallStats.razor index 448c4e32..65d92366 100644 --- a/MP.IOC/Components/Pages/CallStats.razor +++ b/MP.IOC/Components/Pages/CallStats.razor @@ -10,7 +10,7 @@
-
Avail Data (24h)
+
Avail Data (last 24h)