Exemple #1
0
def user_cancele(eventId):
    event = Event.query.filter_by(event_id=int(eventId)).one()
    user = Eventsystem.get_user(current_user)

    try:
        Eventsystem.validate_cancele(event.end)
        user = Eventsystem.check_userin(user, event.users)
        event.users.remove(user)
        db.session.commit()
        return render_template('info.html',
                               event=event,
                               cance=True,
                               message='Cancele success')
    except ErrorMessage as error:
        return render_template('info.html',
                               event=event,
                               canerror=True,
                               message=error.msg)
Exemple #2
0
def cancelesession(sessionId):
    session = Session.query.filter_by(session_id=int(sessionId)).one()
    user = Eventsystem.get_user(current_user)
    seminar = Eventsystem.getSeminar(session)

    try:
        Eventsystem.validate_cancele(session.end)
        user = Eventsystem.check_userin(user, session.users)
        session.users.remove(user)
        db.session.commit()
    except ErrorMessage as error:
        return render_template('sessioninfo.html',
                               sessions=session,
                               not_in=True,
                               message=error.msg)

    if Eventsystem.getUser(user, seminar):
        pass
    else:
        seminar.users.remove(user)
        db.session.commit()

    return render_template('sessioninfo.html', sessions=session)