Пример #1
0
def view_bookings():
    print(' ****************** Your bookings **************** ')
    if not state.active_account:
        print(f"You have to be logged in")
        return

    snakes = {s.id: s for s in svc.get_snakes_for_user(state.active_account)}
    bookings = svc.get_bookings_for_user(state.active_account)

    for b in bookings:
        print(" -> Snake: {}, Booked at: {}, From: {} To: {}".format(
            snakes.get(b.guest_snake_id).name, b.cage,
            datetime.date(b.check_in_date.year, b.check_in_date.month,
                          b.check_in_date.day),
            (b.check_out_date - b.check_in_date).days))
Пример #2
0
def view_bookings():
    print(' ****************** Your bookings **************** ')
    if not state.active_account:
        error_msg("You must log in first to register a shelter")
        return

    pets = {s.id: s for s in svc.get_pets_for_user(state.active_account.id)}
    bookings = svc.get_bookings_for_user(state.active_account.email)

    print("You have {} bookings.".format(len(bookings)))
    for b in bookings:
        # noinspection PyUnresolvedReferences
        print(' * pet: {} is booked at {} from {} for {} days.'.format(
            pets.get(b.guest_pet_id).name, b.shelter.name,
            datetime.date(b.check_in_date.year, b.check_in_date.month,
                          b.check_in_date.day),
            (b.check_out_date - b.check_in_date).days))
Пример #3
0
def view_bookings():
    print(' ****************** Your bookings **************** ')
    if not state.active_account:
        error_msg("You must log in first to register a cage")
        return

    snakes = {s.id: s for s in svc.get_snakes_for_user(state.active_account.id)}
    bookings = svc.get_bookings_for_user(state.active_account.email)

    print("You have {} bookings.".format(len(bookings)))
    for b in bookings:
        print(' * Snake: {} is booked at {} from {} for {} days.'.format(
            snakes.get(b.guest_snake_id).name,
            b.cage.name,
            datetime.date(b.check_in_date.year, b.check_in_date.month, b.check_in_date.day),
            (b.check_out_date - b.check_in_date).days
        ))
def view_bookings():
    print(' ****************** Your bookings **************** ')
    if not state.active_account:
        error_msg("You must log in first to register a cage")
        return

    snakes = {s.id: s for s in svc.get_snakes_for_user(state.active_account.id)}
    bookings = svc.get_bookings_for_user(state.active_account.email)

    print("You have {} bookings.".format(len(bookings)))
    for b in bookings:
        print(' * Snake: {} is booked at {} from {} for {} days.'.format(
            snakes.get(b.guest_snake_id).name,
            b.cage.name,
            datetime.date(b.check_in_date.year, b.check_in_date.month, b.check_in_date.day),
            (b.check_out_date - b.check_in_date).days
        ))
Пример #5
0
def view_bookings():
    print(' ****************** Your bookings **************** ')
    if not state.active_account:
        error_msg("You must log in view your bookings.")
        return

    teachers = {s.id: s for s in svc.get_teachers_for_dancer(state.active_account.id)}
    bookings = svc.get_bookings_for_user(state.active_account.email)

    print("You have {} bookings.".format(len(bookings)))
    for b in bookings:
        # noinspection PyUnresolvedReferences
        print(' * Teacher: {} is booked at Studio ID: {} from {} for {} hours.'.format(
            teachers.get(b.guest_snake_id).name,
            b.guest_studio_id,
            datetime.date(b.check_in_date.year, b.check_in_date.month, b.check_in_date.day),
            (b.check_out_date - b.check_in_date).hours
        ))
Пример #6
0
def view_bookings():
    print(' ****************** Your bookings **************** ')
    account = state.active_account
    if not account:
        error_msg(f'Please Login or create an account')
        return

    snakes = {s.id: s for s in svc.get_snakes_for_user(account.id)}
    print(snakes)
    bookings = svc.get_bookings_for_user(state.active_account.email)

    print("You have {} bookings.".format(len(bookings)))
    for b in bookings:
        # noinspection PyUnresolvedReferences
        print(' * Snake: {} is booked at {} from {} for {} days.'.format(
            snakes.get(b.guest_snake_id).name, b.cage.name,
            datetime.date(b.check_in_date.year, b.check_in_date.month,
                          b.check_in_date.day),
            (b.check_out_date - b.check_in_date).days))
Пример #7
0
def view_bookings():
    print(' ****************** Your bookings **************** ')

    if not state.active_account:
        error_msg('You must login first to view your bookings.')
        return

    snakes = {
        s.id: s
        for s in svc.get_snakes_for_user(state.active_account.id)
    }
    bookings = svc.get_bookings_for_user(state.active_account.email)

    print(f"You have {len(bookings)} bookings.")
    for b in bookings:
        print(
            f" * Snake: {snakes.get(b.guest_snake_id).name} is booked at"
            f" {b.cage.name} from "
            f"{datetime.date(b.check_in_date.year, b.check_in_date.month, b.check_in_date.day)}"
            f" for {(b.check_out_date - b.check_in_date).days} days.")
Пример #8
0
def view_bookings():
    print(' ****************** Your bookings **************** ')

    if not state.active_account:
        hosts.error_msg('You must log in first to add a snake!')
        return

    # Create a dictionary to allocate all the snakes belonging to each persons
    snakes = {
        s.id: s
        for s in svc.get_snakes_for_user(state.active_account.id)
    }
    bookings = svc.get_bookings_for_user(state.active_account.id)

    print('You have {} bookings.'.format(len(bookings)))
    for b in bookings:
        print(' * Snake: {} is booked at {} from {} for {} days.'.format(
            snakes.get(b.guest_snake_id).name, b.cage.name,
            datetime.date(b.check_in_date.year, b.check_in_date.month,
                          b.check_in_date.day),
            (b.check_out_date - b.check_in_date).days))
Пример #9
0
def view_your_joinings():
    print(' ****************** Your joinings **************** ')
    if not state.active_account:
        error_msg("You must log in first to register in a sport")
        return

    sports = {
        s.id: s
        for s in svc.get_sports_for_user(state.active_account.id)
    }
    bookings = svc.get_bookings_for_user(state.active_account.email)

    print("You have {} bookings.".format(len(bookings)))
    for b in bookings:
        print(
            ' * Sport/Event: {} is booked at {} for the date {} for {} minutes.'
            .format(
                sports.get(b.tmember_sport_id).name, b.booked_date,
                datetime.date(b.check_in_time.year, b.check_in_time.month,
                              b.check_in_time.day),
                (b.check_out_time - b.check_out_time).seconds / 60))
Пример #10
0
def view_bookings():
    print(' ****************** Your bookings **************** ')

    if not state.active_account:
        hosts.error_msg("Must be logged in to register a cage")
        return

    snakes = {
        s.id: s
        for s in svc.get_snakes_for_user(state.active_account.id)
    }
    bookings = svc.get_bookings_for_user(state.active_account.id)

    print(f'You have {len(bookings)} booking(s)')
    b: Booking
    for b in bookings:
        hosts.success_msg(
            f' * Snake: {snakes.get(b.guest_snake_id).name} '
            f'is booked in cage {b.cage.name} '
            f'from {datetime.date(b.check_in_date.year, b.check_in_date.month, b.check_in_date.day)} '
            f'for {(b.check_out_date - b.check_in_date).days} days')