示例#1
0
文件: test.py 项目: orestv/pytester
	def GET(self):
		i = web.input()
		attempt_id = i.attempt_id
		test_id = i.test_id
		student_id = web.ctx.session['student_id']
		questions = model.get_questions_for_test(test_id, student_id, attempt_id)
		return render.test('Test', attempt_id, questions)
示例#2
0
文件: test.py 项目: orestv/pytester
 def GET(self):
     i = web.input()
     attempt_id = i.attempt_id
     test_id = i.test_id
     student_id = web.ctx.session['student_id']
     questions = model.get_questions_for_test(test_id, student_id,
                                              attempt_id)
     return render.test('Test', attempt_id, questions)
示例#3
0
文件: flaskr.py 项目: orestv/pytester
def test():
    if not loggedin():
        return redirect("/")
    if not "test_id" in request.args:
        return redirect("/")
    test_id = request.args["test_id"]
    test = model.get_test(test_id)
    student_id = session["student_id"]
    if "continue" in request.args and "attempt_id" in request.args:
        attempt_id = request.args.get("attempt_id")
    else:
        attempt_id = model.start_new_attempt(test_id, student_id)
        return redirect("/test?continue=1&test_id=%s&attempt_id=%s" % (test_id, attempt_id))
    questions = model.get_questions_for_test(attempt_id)
    return render_template("test.html", test_name=test["name"], attempt_id=attempt_id, questions=questions)
示例#4
0
文件: flaskr.py 项目: orestv/pytester
def test():
    if not loggedin():
        return redirect('/')
    if not 'test_id' in request.args:
        return redirect('/')
    test_id = request.args['test_id']
    test = model.get_test(test_id)
    student_id = session['student_id']
    if 'continue' in request.args and 'attempt_id' in request.args:
        attempt_id = request.args.get('attempt_id')
    else:
        attempt_id = model.start_new_attempt(test_id, student_id)
        return redirect('/test?continue=1&test_id=%s&attempt_id=%s' %
                        (test_id, attempt_id))
    questions = model.get_questions_for_test(attempt_id)
    return render_template('test.html',
                           test_name=test['name'],
                           attempt_id=attempt_id,
                           questions=questions)