From 041b77c2050bdfdc19ae39dd7e5e0fb1c9fc0d7f Mon Sep 17 00:00:00 2001 From: Ruidy Date: Tue, 24 Dec 2024 18:17:45 +0100 Subject: [PATCH] fix: only report the non canceled bookings --- internal/repository/booking/pg_store.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/repository/booking/pg_store.go b/internal/repository/booking/pg_store.go index 0807b23..bec8417 100644 --- a/internal/repository/booking/pg_store.go +++ b/internal/repository/booking/pg_store.go @@ -52,6 +52,7 @@ func (ps *PgStore) List(from, to time.Time) ([]*booking.Line, error) { from bookings join items on bookings.id = items.booking_id where "to" between ? and ? + and canceled = false group by bookings.id order by id desc; `, from, to). @@ -69,6 +70,7 @@ func (ps *PgStore) CardTotal(from, to time.Time) (float64, error) { from bookings join items on bookings.id = items.booking_id where "to" between ? and ? + and canceled = false and payment_method = 'Card' group by booking_id) as t; `, from, to).