コード例 #1
0
def registercomfirme(eventId):
    event = Event.query.filter_by(event_id=int(eventId)).one()
    user = Eventsystem.get_user(current_user)

    if event:
        Eventsystem.cal_fee(event.start, user, event)
        return render_template('comfirm.html', event=event, user=user)
    else:
        user.fee = 0
        return 'Not find'
コード例 #2
0
def registsessioncomfirm(sessionId):
    session = Session.query.filter_by(session_id=int(sessionId)).one()
    sesminar = Eventsystem.getSeminar(session)
    user = Eventsystem.get_user(current_user)

    if session:
        Eventsystem.cal_fee(session.start, user, session)
        if Eventsystem.guest_speaker(sesminar, user):
            user.fee = 0
        return render_template('registsessioncomfirm.html',
                               session=session,
                               user=user)
    else:
        user.fee = 0
        return redirect(url_for('page_not_found'))
コード例 #3
0
ファイル: test.py プロジェクト: ShunyangLi/assign2
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