add holiday test and tweak services

This commit is contained in:
2025-10-21 00:26:21 +01:00
parent ded1081a16
commit 989e45e55c
4 changed files with 105 additions and 30 deletions
+9 -1
View File
@@ -318,7 +318,15 @@ func GetAvailableHours(w http.ResponseWriter, r *http.Request) {
// Load bookings
bookingRows, _ := db.DB.Query(r.Context(), `
SELECT b.start_time, COALESCE(SUM(s.duration_minutes),0) as total_duration
SELECT
b.start_time,
COALESCE(SUM(
CASE
WHEN bs.override_duration_minutes IS NOT NULL AND bs.override_duration_minutes > 0
THEN bs.override_duration_minutes
ELSE s.duration_minutes
END
), 0) AS total_duration
FROM bookings b
LEFT JOIN booking_services bs ON b.id = bs.booking_id
LEFT JOIN services s ON bs.service_id = s.id