fix upcoming deliveries display count on calendar
Build and Push Docker Images / build-backend (push) Canceled after 0s
Build and Push Docker Images / build-frontend (push) Canceled after 0s

This commit is contained in:
Egor Pozharov
2026-08-03 14:06:05 +06:00
parent 906563c7c3
commit 1860e52b88
5 changed files with 21 additions and 9 deletions
+5 -1
View File
@@ -70,7 +70,11 @@ WHERE id = $21;
-- name: GetDeliveryCount :many
SELECT COUNT(*) as count, date FROM deliveries
WHERE date >= CURRENT_DATE AND date < CURRENT_DATE + INTERVAL '7 days'
WHERE date >= CURRENT_DATE
AND date < GREATEST(
CURRENT_DATE + INTERVAL '7 days',
DATE_TRUNC('month', CURRENT_DATE) + INTERVAL '1 month'
)
GROUP BY date;
-- name: UpdateDeliveryStatus :exec
+5 -1
View File
@@ -218,7 +218,11 @@ func (q *Queries) GetDeliveryByID(ctx context.Context, id pgtype.UUID) (Delivery
const getDeliveryCount = `-- name: GetDeliveryCount :many
SELECT COUNT(*) as count, date FROM deliveries
WHERE date >= CURRENT_DATE AND date < CURRENT_DATE + INTERVAL '7 days'
WHERE date >= CURRENT_DATE
AND date < GREATEST(
CURRENT_DATE + INTERVAL '7 days',
DATE_TRUNC('month', CURRENT_DATE) + INTERVAL '1 month'
)
GROUP BY date
`