예제 #1
0
def reschedule_event(user_id):
    """
    Call functions to change event date

    Examples:
        "st" are two first signs of student id
    """

    choice = None
    temp_event_list = []

    for event in Event.events:
        if event.user_id == user_id or event.user_id[0:2] == "st":
            temp_event_list.append(event)

    head = "Chose option:"
    exit_msg = "Exit event reschedule"

    view.print_menu(head, temp_event_list, exit_msg)
    choice = view.get_choice()
    choice = int(choice) - 1

    if choice == -1:
        pass
    elif choice >= len(temp_event_list):
        view.print_msg("No such event!\n")
    else:

        view.print_msg("Enter new event date")
        new_date = view.get_event_date()

        new_date = validate_date(new_date)

        if new_date is not None:
            Event.change_date(temp_event_list[choice], new_date)
예제 #2
0
def reschedule_event(user_id):
    """
    Call functions to change event date
    """

    choice = None
    temp_event_list = []

    for event in Event.events:
        if event.__class__.__name__ == "PrivateMentoring" and event.user_id == user_id:
            temp_event_list.append(event)

    head = "Chose option:"
    exit_msg = "Exit event reschedule"

    view.print_menu(head, temp_event_list, exit_msg)

    choice = view.get_choice()
    choice = int(choice) - 1

    if choice == -1:
        pass
    elif choice >= len(temp_event_list):
        view.print_msg("No such event!\n")
    else:

        view.print_msg("Enter new event date")
        new_date = view.get_event_date()

        new_date = validate_date(new_date)

        if new_date is not None:
            Event.change_date(temp_event_list[choice], new_date)