From 8c9c78a789e0eb5cacc09a5e5925ae27f9030300 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 7 Dec 2021 20:28:48 +0000 Subject: [PATCH] Fix between call being inclusive --- postgres/categories.sql.go | 4 ++-- postgres/queries/categories.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/postgres/categories.sql.go b/postgres/categories.sql.go index 7642991..a2bc73c 100644 --- a/postgres/categories.sql.go +++ b/postgres/categories.sql.go @@ -135,7 +135,7 @@ SELECT categories.id, categories.name, category_groups.name as group, SELECT SUM(t_this.amount) FROM transactions t_this WHERE categories.id = t_this.category_id - AND t_this.date BETWEEN $1 AND $2 + AND t_this.date >= $1 AND t_this.date < $2 ) , 0)::decimal(12,2) as activity, COALESCE( @@ -143,7 +143,7 @@ SELECT categories.id, categories.name, category_groups.name as group, SELECT SUM(a_hist.amount) FROM assignments a_hist WHERE categories.id = a_hist.category_id - AND a_hist.date BETWEEN $1 AND $2 + AND a_hist.date >= $1 AND a_hist.date < $2 ) ,0)::decimal(12,2) as assigned diff --git a/postgres/queries/categories.sql b/postgres/queries/categories.sql index 3a01632..d13a8d4 100644 --- a/postgres/queries/categories.sql +++ b/postgres/queries/categories.sql @@ -41,7 +41,7 @@ SELECT categories.id, categories.name, category_groups.name as group, SELECT SUM(t_this.amount) FROM transactions t_this WHERE categories.id = t_this.category_id - AND t_this.date BETWEEN @from_date AND @to_date + AND t_this.date >= @from_date AND t_this.date < @to_date ) , 0)::decimal(12,2) as activity, COALESCE( @@ -49,7 +49,7 @@ SELECT categories.id, categories.name, category_groups.name as group, SELECT SUM(a_hist.amount) FROM assignments a_hist WHERE categories.id = a_hist.category_id - AND a_hist.date BETWEEN @from_date AND @to_date + AND a_hist.date >= @from_date AND a_hist.date < @to_date ) ,0)::decimal(12,2) as assigned