limit task status chart to 7 days
All checks were successful
/ release (push) Successful in 28s

This commit is contained in:
Samuel Lorch 2024-07-14 02:36:53 +02:00
parent 64315356ae
commit 8b6e20ba00

View file

@ -204,7 +204,7 @@ func generateStats(ctx context.Context) ([]ChartData, error) {
rows, err = db.Query(ctx, rows, err = db.Query(ctx,
`SELECT date_trunc('day', updated_at) date, status, COUNT(*) AS count `SELECT date_trunc('day', updated_at) date, status, COUNT(*) AS count
FROM tasks FROM tasks
WHERE status = $1 OR status = $2 WHERE updated_at > current_date - 7 AND (status = $1 OR status = $2)
GROUP BY 1,2 GROUP BY 1,2
ORDER BY date ;`, constants.TASK_STATUS_SUCCESS, constants.TASK_STATUS_FAILED) ORDER BY date ;`, constants.TASK_STATUS_SUCCESS, constants.TASK_STATUS_FAILED)
if err != nil { if err != nil {