From 8b6e20ba00f1a5d2189a496b7a26952e4c9cfc6a Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Sun, 14 Jul 2024 02:36:53 +0200 Subject: [PATCH] limit task status chart to 7 days --- server/stats.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/stats.go b/server/stats.go index dfbc2b9..ceb46b6 100644 --- a/server/stats.go +++ b/server/stats.go @@ -204,7 +204,7 @@ func generateStats(ctx context.Context) ([]ChartData, error) { rows, err = db.Query(ctx, `SELECT date_trunc('day', updated_at) date, status, COUNT(*) AS count FROM tasks - WHERE status = $1 OR status = $2 + WHERE updated_at > current_date - 7 AND (status = $1 OR status = $2) GROUP BY 1,2 ORDER BY date ;`, constants.TASK_STATUS_SUCCESS, constants.TASK_STATUS_FAILED) if err != nil {