Beispiel #1
0
class TestGuestRegisterSeminar(object):
    seminar = Seminar.query.filter_by(seminar_id=2).one()
    assert seminar is not None
    session = Session.query.filter_by(session_id=3).one()
    assert session is not None
    user = User.query.filter_by(user_id=26).one()
    assert user is not None
    assert Eventsystem.Validate_Session_regist(
        user, session.sessions_all.all()) is True
    assert Eventsystem.speakerof_seesion(user, session) is True

    Eventsystem.cal_fee(session.start, user, session)
    assert user.fee == 50.0

    session = Session.query.filter_by(session_id=6).one()
    assert Eventsystem.Validate_Session_regist(
        user, session.sessions_all.all()) is True
    assert Eventsystem.speakerof_seesion(user, session) is True

    Eventsystem.cal_fee(session.start, user, session)
    assert user.fee == 1.0
Beispiel #2
0
def registsession(sessionId):
    session = Session.query.filter_by(session_id=int(sessionId)).one()
    user = Eventsystem.get_user(current_user)
    seminar = Eventsystem.getSeminar(session)

    try:
        Eventsystem.validateRegistSession(session)
        Eventsystem.validateRegistSeminar(seminar)
        Eventsystem.Validate_Session_regist(user, session.sessions_all.all())
        Eventsystem.speakerof_seesion(user, session)
        session.users.append(user)
        db.session.commit()
        if Eventsystem.validate_Seminar_regist(user, seminar.users):
            seminar.users.append(user)
            db.session.commit()
        return render_template('sessioninfo.html',
                               sessions=session,
                               succ=True,
                               message='Success regist')
    except ErrorMessage as error:
        return render_template('sessioninfo.html',
                               regist=True,
                               message=error.msg,
                               sessions=session)