Beispiel #1
0
def test_report(test_id):
    if not is_admin():
        return redirect(url_for('admin'))
    test = model.get_test(test_id)
    results = model.get_test_report(test_id)
    return render_template('test_report.html',
                           test_name=test['name'],
                           results=results)
 def GET(self, host, commit_id):
     """ View results for a single commit on a host"""
     test = model.get_test(host, commit_id)
     if test is None:
         return 'commit %s not found' % commit_id
     else:
         return render.view(test,
                            os.path.join(REPO_URL,'commit',commit_id))
Beispiel #3
0
def attempt_report():
    is_json = request.args.get("json", False)
    if not loggedin() and not is_admin():
        return "login_fail" if is_json else redirect("/")
    if not "attempt_id" in request.args:
        return redirect("/")
    attempt_id = request.args["attempt_id"]
    attempt = model.get_attempt(attempt_id)
    test = model.get_test(attempt["test_id"])
    if is_json:
        return json.dumps(model.get_attempt_report(attempt_id))
    else:
        return render_template("attempt_report.html", test_name=test["name"], attempt_id=attempt_id)
Beispiel #4
0
def attempt_report():
    is_json = request.args.get('json', False)
    if not loggedin() and not is_admin():
        return 'login_fail' if is_json else redirect('/')
    if not 'attempt_id' in request.args:
        return redirect('/')
    attempt_id = request.args['attempt_id']
    attempt = model.get_attempt(attempt_id)
    test = model.get_test(attempt['test_id'])
    if is_json:
        return json.dumps(model.get_attempt_report(attempt_id))
    else:
        return render_template('attempt_report.html',
                               test_name=test['name'],
                               attempt_id=attempt_id)
Beispiel #5
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)
Beispiel #6
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)
 def GET(self, host, commit_id):
     """ View results for a single commit on a host"""
     test = model.get_test(host, commit_id)
     return render.view(test,
                        os.path.join(REPO_URL,'commit',commit_id))
Beispiel #8
0
def test_report(test_id):
    if not is_admin():
        return redirect(url_for("admin"))
    test = model.get_test(test_id)
    results = model.get_test_report(test_id)
    return render_template("test_report.html", test_name=test["name"], results=results)