From 148df38219bf813a2d44da91daee17d8ba265c69 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Thu, 22 Jan 2026 10:20:18 +1100 Subject: [PATCH] fix daily aggregation --- internal/tasks/dailyAggregate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/tasks/dailyAggregate.go b/internal/tasks/dailyAggregate.go index 2658ac4..2b4564a 100644 --- a/internal/tasks/dailyAggregate.go +++ b/internal/tasks/dailyAggregate.go @@ -24,7 +24,8 @@ func (c *CronTask) RunVcenterDailyAggregate(ctx context.Context, logger *slog.Lo defer func() { logger.Info("Daily summary job finished", "duration", time.Since(startedAt)) }() - targetTime := time.Now().Add(-time.Minute) + // Aggregate the previous day to avoid partial "today" data when the job runs just after midnight. + targetTime := time.Now().AddDate(0, 0, -1) // Always force regeneration on the scheduled run to refresh data even if a manual run happened earlier. return c.aggregateDailySummary(jobCtx, targetTime, true) })