Fixing issue with weekend reservations due to different opening times (and as a result different start times for the courts)
This commit is contained in:
parent
047845155e
commit
b8418f9ab2
1 changed files with 128 additions and 69 deletions
|
|
@ -119,74 +119,128 @@ export const StartTimeClassCourtSlots: Record<
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
const StartTimeClassStartTimes = {
|
const StartTimeClassStartTimes = {
|
||||||
[StartTimeClass.First]: [
|
[StartTimeClass.First]: {
|
||||||
'07:15',
|
weekday: [
|
||||||
'08:00',
|
'07:15',
|
||||||
'08:45',
|
'08:00',
|
||||||
'09:30',
|
'08:45',
|
||||||
'10:15',
|
'09:30',
|
||||||
'11:00',
|
'10:15',
|
||||||
'11:45',
|
'11:00',
|
||||||
'12:30',
|
'11:45',
|
||||||
'13:15',
|
'12:30',
|
||||||
'14:00',
|
'13:15',
|
||||||
'14:45',
|
'14:00',
|
||||||
'15:30',
|
'14:45',
|
||||||
'16:15',
|
'15:30',
|
||||||
'17:00',
|
'16:15',
|
||||||
'17:45',
|
'17:00',
|
||||||
'18:30',
|
'17:45',
|
||||||
'19:15',
|
'18:30',
|
||||||
'20:00',
|
'19:15',
|
||||||
'20:45',
|
'20:00',
|
||||||
'21:30',
|
'20:45',
|
||||||
'22:15',
|
'21:30',
|
||||||
],
|
'22:15',
|
||||||
[StartTimeClass.Second]: [
|
],
|
||||||
'07:45',
|
weekend: [
|
||||||
'08:30',
|
'09:00',
|
||||||
'09:15',
|
'09:45',
|
||||||
'10:00',
|
'10:30',
|
||||||
'10:45',
|
'11:15',
|
||||||
'11:30',
|
'12:00',
|
||||||
'12:15',
|
'12:45',
|
||||||
'13:00',
|
'13:30',
|
||||||
'13:45',
|
'14:15',
|
||||||
'14:30',
|
'15:00',
|
||||||
'15:15',
|
'15:45',
|
||||||
'16:00',
|
'16:30',
|
||||||
'16:45',
|
'17:15',
|
||||||
'17:30',
|
'18:00',
|
||||||
'18:15',
|
'18:45',
|
||||||
'19:00',
|
],
|
||||||
'19:45',
|
},
|
||||||
'20:30',
|
[StartTimeClass.Second]: {
|
||||||
'21:15',
|
weekday: [
|
||||||
'22:00',
|
'07:45',
|
||||||
],
|
'08:30',
|
||||||
[StartTimeClass.Third]: [
|
'09:15',
|
||||||
'07:30',
|
'10:00',
|
||||||
'08:15',
|
'10:45',
|
||||||
'09:00',
|
'11:30',
|
||||||
'09:45',
|
'12:15',
|
||||||
'10:30',
|
'13:00',
|
||||||
'11:15',
|
'13:45',
|
||||||
'12:00',
|
'14:30',
|
||||||
'12:45',
|
'15:15',
|
||||||
'13:30',
|
'16:00',
|
||||||
'14:15',
|
'16:45',
|
||||||
'15:00',
|
'17:30',
|
||||||
'15:45',
|
'18:15',
|
||||||
'16:30',
|
'19:00',
|
||||||
'17:15',
|
'19:45',
|
||||||
'18:00',
|
'20:30',
|
||||||
'18:45',
|
'21:15',
|
||||||
'19:30',
|
'22:00',
|
||||||
'20:15',
|
],
|
||||||
'21:00',
|
weekend: [
|
||||||
'21:45',
|
'09:15',
|
||||||
'22:30',
|
'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
|
const TYPING_DELAY_MS = 2
|
||||||
|
|
@ -739,7 +793,12 @@ export class BaanReserverenService {
|
||||||
|
|
||||||
public getCourtSlotsForDate(date: Dayjs) {
|
public getCourtSlotsForDate(date: Dayjs) {
|
||||||
const time = date.format('HH:mm')
|
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)) {
|
if (times.includes(time)) {
|
||||||
const courtSlots = [
|
const courtSlots = [
|
||||||
...StartTimeClassCourtSlots[timeClass as StartTimeClass],
|
...StartTimeClassCourtSlots[timeClass as StartTimeClass],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue