Beispiel #1
0
def dashboard():
    # Renders admin or user dashboards, depending on admin privileges of user
    if DBProxy.check_admin(get_email_from_request()):
        all_users = DBProxy.get_all_judges()  # All judges in the system
        all_group_projects = DBProxy.get_all_group_projects(
        )  # All non-public projects
        public_projects = DBProxy.get_all_public_projects(
        )  # All public projects
        return render_template(
            'admindashboard.html',
            all_users=all_users,
            all_group_projects=all_group_projects,
            public_projects=public_projects,
            selector_algorithms=pairselector_options,
        )
    # Not admin, render user dashboard
    judge = DBProxy.get_judge(request.cookies.get('email'))
    all_public_projects = DBProxy.get_all_public_projects()
    filtered_public_projects = [
        p for p in all_public_projects if judge not in p.judges
    ]
    return render_template('userdashboard.html',
                           filtered_public_projects=filtered_public_projects)
Beispiel #2
0
def get_judge():
    judge = DBProxy.get_judge(get_email_from_request())
    if judge is None:
        return dummy_judge
    return judge