def join_event():
    global current_event
    global current_user
    event_id = event_id_input.get()
    current_event = EventController.retrieve_event(event_id)
    if current_event == Errors.MISSING.name:
        add_output('Event not found. \n')
        current_event = None
        return
    elif current_event == Errors.FAILURE.name:
        add_output('Failed to join event. \n')
        current_event = None
        return
    if not current_user:
        add_output('You have to login first to join events. \n')
        current_event = None
        return

    result = EventController.join_event(current_user, current_event)
    if result == Errors.DUPLICATE.name:
        add_output('You have already joined the event. \n')
    elif result == Errors.FAILURE.name:
        return_failure()
        current_event = None
        return
    else:
        add_output('You have joined event #' + current_event.eid +
                   '. User ID: ' + current_user.uid + '. \n')

    EventController.print_event(current_event)
    return
Exemple #2
0
def attend_event(data):
    result = EventController.join_event(data)
    return result