示例#1
0
def get_context():
    project_name = request.args.get('project', DEFAULT_PROJECT)
    time = request.args.get('time', DEFAULT_TIME_OPTION)
    since = datetime.now() - timedelta(hours=TIME_OPTIONS[time])
    project = db.get_project(project_name)
    patch_sets = db.get_patch_sets(project, since)
    results = OrderedDict()
    for ci in db.get_ci_servers():
        ci_info = _get_ci_info_for_patch_sets(ci, patch_sets)
        if any(result for result in ci_info["results"]):
            results[ci.ci_owner] = results.get(ci.ci_owner, [])
            results[ci.ci_owner].append(
                _get_ci_info_for_patch_sets(ci, patch_sets))

    return {"time_options": get_time_options(),
            "time_option": time,
            "patch_sets": patch_sets,
            "project": project,
            "projects": db.get_projects(),
            "user_results": results}
示例#2
0
def home():
    try:
        return render_template(
            'index.html.jinja', projects=db.get_projects())
    finally:
        db.Session.remove()