Fixing issue with weekend reservations due to different opening times (and as a result different start times for the courts)
All checks were successful
ci/woodpecker/manual/test Pipeline was successful
ci/woodpecker/manual/deploy Pipeline was successful

This commit is contained in:
collin 2026-07-24 12:50:28 +02:00
parent 047845155e
commit b8418f9ab2

View file

@ -119,74 +119,128 @@ export const StartTimeClassCourtSlots: Record<
} as const
const StartTimeClassStartTimes = {
[StartTimeClass.First]: [
'07:15',
'08:00',
'08:45',
'09:30',
'10:15',
'11:00',
'11:45',
'12:30',
'13:15',
'14:00',
'14:45',
'15:30',
'16:15',
'17:00',
'17:45',
'18:30',
'19:15',
'20:00',
'20:45',
'21:30',
'22:15',
],
[StartTimeClass.Second]: [
'07:45',
'08:30',
'09:15',
'10:00',
'10:45',
'11:30',
'12:15',
'13:00',
'13:45',
'14:30',
'15:15',
'16:00',
'16:45',
'17:30',
'18:15',
'19:00',
'19:45',
'20:30',
'21:15',
'22:00',
],
[StartTimeClass.Third]: [
'07:30',
'08:15',
'09:00',
'09:45',
'10:30',
'11:15',
'12:00',
'12:45',
'13:30',
'14:15',
'15:00',
'15:45',
'16:30',
'17:15',
'18:00',
'18:45',
'19:30',
'20:15',
'21:00',
'21:45',
'22:30',
],
[StartTimeClass.First]: {
weekday: [
'07:15',
'08:00',
'08:45',
'09:30',
'10:15',
'11:00',
'11:45',
'12:30',
'13:15',
'14:00',
'14:45',
'15:30',
'16:15',
'17:00',
'17:45',
'18:30',
'19:15',
'20:00',
'20:45',
'21:30',
'22:15',
],
weekend: [
'09:00',
'09:45',
'10:30',
'11:15',
'12:00',
'12:45',
'13:30',
'14:15',
'15:00',
'15:45',
'16:30',
'17:15',
'18:00',
'18:45',
],
},
[StartTimeClass.Second]: {
weekday: [
'07:45',
'08:30',
'09:15',
'10:00',
'10:45',
'11:30',
'12:15',
'13:00',
'13:45',
'14:30',
'15:15',
'16:00',
'16:45',
'17:30',
'18:15',
'19:00',
'19:45',
'20:30',
'21:15',
'22:00',
],
weekend: [
'09:15',
'10:00',
'10:45',
'11:30',
'12:15',
'13:00',
'13:45',
'14:30',
'15:15',
'16:00',
'16:45',
'17:30',
'18:15',
'19:00',
],
},
[StartTimeClass.Third]: {
weekday: [
'07:30',
'08:15',
'09:00',
'09:45',
'10:30',
'11:15',
'12:00',
'12:45',
'13:30',
'14:15',
'15:00',
'15:45',
'16:30',
'17:15',
'18:00',
'18:45',
'19:30',
'20:15',
'21:00',
'21:45',
'22:30',
],
weekend: [
'08:45',
'09:30',
'10:15',
'11:00',
'11:45',
'12:30',
'13:15',
'14:00',
'14:45',
'15:30',
'16:15',
'17:00',
'17:45',
'18:30',
],
},
}
const TYPING_DELAY_MS = 2
@ -739,7 +793,12 @@ export class BaanReserverenService {
public getCourtSlotsForDate(date: Dayjs) {
const time = date.format('HH:mm')
for (const [timeClass, times] of Object.entries(StartTimeClassStartTimes)) {
const weekdayEndSelector =
date.day() !== 0 || date.day() !== 6 ? 'weekday' : 'weekend'
for (const [timeClass, timesForWeekdayAndWeekend] of Object.entries(
StartTimeClassStartTimes,
)) {
const times = timesForWeekdayAndWeekend[weekdayEndSelector]
if (times.includes(time)) {
const courtSlots = [
...StartTimeClassCourtSlots[timeClass as StartTimeClass],