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) })