Fase 6 — Motore dal vivo in simulazione #92

Merged
Alby96 merged 12 commits from fase-6 into main 2026-11-11 22:30:56 +01:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit 1c7205024f - Show all commits

No files matched your search

+4 -2
View File
@@ -83,8 +83,10 @@ public static class SoakReporter
.ConfigureAwait(false);
var absences = await s.QueryAsync("SELECT started_at, ended_at FROM absences WHERE ended_at >= @from AND started_at <= @to ORDER BY started_at",
r => (Start: r.Moment("started_at"), End: r.Moment("ended_at")), window).ConfigureAwait(false);
var start = jobs.First is { } first && first > from ? first : from;
var end = jobs.Last is { } lastJob && lastJob < to ? lastJob : to;
// A gap shorter than the longest silence allowed at either end (the first jobs come a minute after the start,
// the last one up to 5 minutes before the end) is no more a hole than one in the middle.
var start = jobs.First is { } first && first > from + MaxSilence ? first : from;
var end = jobs.Last is { } lastJob && lastJob < to - MaxSilence ? lastJob : to;
var covered = jobs.First is null || jobs.Last is null || end <= start ? TimeSpan.Zero
: end - start - absences.Aggregate(TimeSpan.Zero, (sum, a) => sum + (Min(a.End, end) - Max(a.Start, start) is { } span && span > TimeSpan.Zero ? span : TimeSpan.Zero));
checks.Add(new SoakCheck($"Durata coperta dal lavoro del bot: {SoakReport.Hours(covered)} (servono almeno {SoakReport.Hours(minimum)}).", covered >= minimum));
+1 -1
View File
@@ -54,7 +54,7 @@ public sealed class SoakReportTests
var text = report.Markdown(Zones.Rome);
Assert.IsTrue(report.Passed, text);
Assert.Contains("**Esito: regolare.**", text);
Assert.Contains("Durata coperta dal lavoro del bot: 49,0 ore", text);
Assert.Contains("Durata coperta dal lavoro del bot: 49 ore", text);
Assert.Contains("Al lavoro dall'inizio alla fine della finestra.", text);
Assert.Contains("Ogni conto riconciliato fino alla fine e in regola: ", text);
Assert.Contains("Decisioni di crypto_trend: 2 su 2 chiusure giornaliere.", text);