def checkReservation(): reservations = Reservation.query( Reservation.start_datetime_string == getCurrentDatetime().strftime("%m/%d/%y,%H:%M")) for reservation in reservations: mail.send_mail(sender="Open Reservation Team <*****@*****.**>", to=reservation.user, subject='Reservation Start Notification', body=''' Dear %s: Your reservation of %s starts now! The Open Reservation Team ''' % (reservation.user, reservation.resource_name))
def checkReservationConflict(resname, dt_start, dt_end): reservations = Reservation.query(Reservation.resource_name == resname).order(Reservation.start_datetime) prev_end_time = None last_reservation = None for reservation in reservations: if dt_end <= reservation.start_datetime: if prev_end_time is None or dt_start >= prev_end_time: return True else: return False last_reservation = reservation if last_reservation is None or dt_start >= last_reservation.end_datetime: return True return False
def checkReservation(): reservations = Reservation.query( Reservation.start_datetime_string == getCurrentDatetime().strftime( "%m/%d/%y,%H:%M")) for reservation in reservations: mail.send_mail(sender="Open Reservation Team <*****@*****.**>", to=reservation.user, subject='Reservation Start Notification', body=''' Dear %s: Your reservation of %s starts now! The Open Reservation Team ''' % (reservation.user, reservation.resource_name))
def checkReservationConflict(resname, dt_start, dt_end): reservations = Reservation.query( Reservation.resource_name == resname).order(Reservation.start_datetime) prev_end_time = None last_reservation = None for reservation in reservations: if dt_end <= reservation.start_datetime: if prev_end_time is None or dt_start >= prev_end_time: return True else: return False last_reservation = reservation if last_reservation is None or dt_start >= last_reservation.end_datetime: return True return False
def deleteOutDateReservation(): out_date_res = Reservation.query(Reservation.end_datetime < getCurrentDatetime()) for reservation in out_date_res: reservation.key.delete()
def deleteOutDateReservation(): out_date_res = Reservation.query( Reservation.end_datetime < getCurrentDatetime()) for reservation in out_date_res: reservation.key.delete()