Ejemplo n.º 1
0
 def GET(self):
     i = web.input()
     test_id = i.test_id
     student_id = web.ctx.session['student_id']
     attempt_id = model.start_new_attempt(test_id, student_id)
     raise web.seeother('/test?attempt_id=%s&test_id=%s' %
                        (attempt_id, test_id))
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
	def GET(self):
		i = web.input()
		test_id = i.test_id
		student_id = web.ctx.session['student_id']
		attempt_id = model.start_new_attempt(test_id, student_id)
		raise web.seeother('/test?attempt_id=%s&test_id=%s'%(attempt_id, test_id))