Changing recurringReservations to schedule a reservation for 1 week in advance
This commit is contained in:
parent
528fac9a15
commit
c26868a49a
2 changed files with 4 additions and 2 deletions
|
|
@ -46,17 +46,19 @@ export class RecurringReservation {
|
|||
opponentName: string
|
||||
|
||||
@Exclude()
|
||||
public createReservation(): Reservation {
|
||||
public createReservationInAdvance(daysInAdvance = 7): Reservation {
|
||||
const [hourStart, minuteStart] = this.timeStart.split(':')
|
||||
const [hourEnd, minuteEnd] = this.timeEnd.split(':')
|
||||
const dateRangeStart = dayjs()
|
||||
.set('day', this.dayOfWeek)
|
||||
.set('hour', Number.parseInt(hourStart))
|
||||
.set('minute', Number.parseInt(minuteStart))
|
||||
.add(daysInAdvance, 'days')
|
||||
const dateRangeEnd = dayjs()
|
||||
.set('day', this.dayOfWeek)
|
||||
.set('hour', Number.parseInt(hourEnd))
|
||||
.set('minute', Number.parseInt(minuteEnd))
|
||||
.add(daysInAdvance, 'days')
|
||||
const reservation = new Reservation({
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export class RecurringReservationsService {
|
|||
}
|
||||
|
||||
scheduleReservation(recurringReservation: RecurringReservation) {
|
||||
const reservation = recurringReservation.createReservation()
|
||||
const reservation = recurringReservation.createReservationInAdvance()
|
||||
return this.reservationsService.create(reservation)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue