report query fixes

This commit is contained in:
Yared Yemane 2025-08-20 15:56:50 +03:00
parent 0779cd35fe
commit 6425196115

View File

@ -135,10 +135,10 @@ func SetupReportCronJobs(ctx context.Context, reportService *report.Service, out
spec string spec string
period string period string
}{ }{
{ // {
spec: "*/60 * * * * *", // Every 5 minutes // spec: "*/60 * * * * *", // Every 5 minutes
period: "5min", // period: "5min",
}, // },
{ {
spec: "0 0 0 * * *", // Daily at midnight spec: "0 0 0 * * *", // Daily at midnight
period: "daily", period: "daily",
@ -161,9 +161,9 @@ func SetupReportCronJobs(ctx context.Context, reportService *report.Service, out
var from, to time.Time var from, to time.Time
switch period { switch period {
case "5min": // case "5min":
from = now.Add(-5 * time.Minute) // from = now.Add(-5 * time.Minute)
to = now // to = now
case "daily": case "daily":
from = time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, now.Location()) from = time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, now.Location())
to = time.Date(now.Year(), now.Month(), now.Day()-1, 23, 59, 59, 0, now.Location()) to = time.Date(now.Year(), now.Month(), now.Day()-1, 23, 59, 59, 0, now.Location())