From 6bff5ccc18583fb24ebc614a74a3af0683dcb3ed Mon Sep 17 00:00:00 2001 From: Ruidy Date: Fri, 28 Jun 2024 17:03:23 +0200 Subject: [PATCH] use left join for bookings and items --- README.md | 4 ++++ internal/booking/service.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e3636a..f37011b 100644 --- a/README.md +++ b/README.md @@ -103,3 +103,7 @@ Don't forget to give the project a star! Thanks again! ## License Distributed under the MIT License. See `LICENSE.md` for more information. + +## TODO + +- [ ] other dates are not stored/parsed properly diff --git a/internal/booking/service.go b/internal/booking/service.go index d473159..6bb2be4 100644 --- a/internal/booking/service.go +++ b/internal/booking/service.go @@ -29,7 +29,7 @@ func (bs Service) All() []*Line { bs.db.Raw(` select bookings.id, customer_name, "from", "to", platform, sum(price * quantity) as total, canceled from bookings - join items on bookings.id = items.booking_id + left join items on bookings.id = items.booking_id group by bookings.id order by id desc; `).