def private(): infos = get_infos() errors = get_errors() user = get_current_user() if not user.team_id: return render_template("teams/team_enrollment.html") team_id = user.team_id team = Teams.query.filter_by(id=team_id).first_or_404() solves = team.get_solves() awards = team.get_awards() place = team.place score = team.score if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") return render_template( "teams/private.html", solves=solves, awards=awards, user=user, team=team, score=score, place=place, score_frozen=config.is_scoreboard_frozen(), infos=infos, errors=errors, )
def public(team_id): infos = get_infos() errors = get_errors() team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404() solves = team.get_solves() awards = team.get_awards() place = team.place score = team.score if errors: return render_template("teams/public.html", team=team, errors=errors) if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") return render_template( "teams/public.html", solves=solves, awards=awards, team=team, score=score, place=place, score_frozen=config.is_scoreboard_frozen(), infos=infos, errors=errors, )
def private(): user = get_current_user() if not user.team_id: return render_template( 'teams/team_enrollment.html', ) team_id = user.team_id team = Teams.query.filter_by(id=team_id).first_or_404() solves = team.get_solves() awards = team.get_awards() place = team.place score = team.score return render_template( 'teams/team.html', solves=solves, awards=awards, user=user, team=team, score=score, place=place, score_frozen=config.is_scoreboard_frozen() )
def public(team_id): standings = get_standings() errors = get_errors() team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404() solves = team.get_solves() awards = team.get_awards() score = 0 place = None for c, i in enumerate(standings): if i['teamid'] == team_id: place = c + 1 score = i['score'] break if errors: return render_template("teams/public.html", team=team, errors=errors) return render_template( "teams/public.html", solves=solves, awards=awards, team=team, score=score, place=place, score_frozen=is_scoreboard_frozen(), )
def multi_scoreboard(sb=None): if sb == None: sb = 'Global' infos = get_infos() if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") if is_admin() is True and scores_visible() is False: infos.append("Scores are not currently visible to users") standings = get_standings() teams = [] scoreboards = ["Global"] for t in Teams.query.all(): if sb == "Global" and (t.name not in teams): teams.append(t.name) for f in t.fields: if f.name not in scoreboards: scoreboards.append(f.name) if f.name == sb and (t.name not in teams): teams.append(t.name) if sb not in scoreboards: abort(404) filtered_standings = [st for st in standings if st[2] in teams] return render_template("multi_scoreboard.html", standings=filtered_standings, infos=infos, scoreboards=scoreboards, scoreboard=sb)
def listing(): standings = get_standings() return render_template( "scoreboard.html", standings=standings, score_frozen=config.is_scoreboard_frozen(), )
def private(): standings = get_standings() user = get_current_user() if not user.team_id: return render_template("teams/team_enrollment.html") score = 0 place = None team_id = user.team_id team = Teams.query.filter_by(id=team_id).first_or_404() solves = team.get_solves() awards = team.get_awards() for c, i in enumerate(standings): if i['teamid'] == team_id: place = c + 1 score = i['score'] break return render_template( "teams/private.html", solves=solves, awards=awards, user=user, team=team, score=score, place=place, score_frozen=is_scoreboard_frozen(), )
def listing(): infos = get_infos() if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") standings = get_standings() return render_template("scoreboard.html", standings=standings, infos=infos)
def scoreboard_view(): standings = get_standings() infos = get_infos() if is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") return render_template('scoreboard-matrix.html', standings=standings, challenges=get_challenges())
def public(user_id): infos = get_infos() errors = get_errors() user = Users.query.filter_by(id=user_id, banned=False, hidden=False).first_or_404() if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") return render_template( "users/public.html", user=user, account=user.account, infos=infos, errors=errors )
def listing(): infos = get_infos() if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") if is_admin() is True and scores_visible() is False: infos.append("Scores are not currently visible to users") standings = get_standings() return render_template("scoreboard.html", standings=standings, infos=infos)
def listing(): infos = get_infos() if config.is_scoreboard_frozen(): infos.append("Результаты заморожены") if is_admin() is True and scores_visible() is False: infos.append("Результаты сейчас не отображаются для участников") standings = get_standings() return render_template("scoreboard.html", standings=standings, infos=infos)
def scoreboard_view(): if scores_visible() and not authed(): return redirect(url_for('auth.login', next=request.path)) if not scores_visible(): return render_template('scoreboard.html', errors=['Scores are currently hidden']) standings = get_standings() challenges, categories = get_challenges() return render_template('scoreboard.html', standings=standings, score_frozen=is_scoreboard_frozen(), mode='users' if is_users_mode() else 'teams', challenges=challenges, categories=categories, theme=ctf_theme())
def private(): infos = get_infos() errors = get_errors() user = get_current_user() if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") return render_template( "users/private.html", user=user, account=user.account, infos=infos, errors=errors, )
def listing(): infos = get_infos() if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") if is_admin() is True and scores_visible() is False: infos.append("Scores are not currently visible to users") standings = get_standings() standings_interne = [s for s in standings if s.fields != True] standings_externe = [s for s in standings if s.fields == True] return render_template("scoreboard.html", standings_interne=standings_interne, standings_externe=standings_externe, infos=infos)
def private(): user = get_current_user() solves = user.get_solves() awards = user.get_awards() place = user.place score = user.score return render_template('users/private.html', solves=solves, awards=awards, user=user, score=score, place=place, score_frozen=config.is_scoreboard_frozen())
def public(team_id): errors = get_errors() team = Teams.query.filter_by(id=team_id).first_or_404() solves = team.get_solves() awards = team.get_awards() place = team.place score = team.score if errors: return render_template('teams/team.html', team=team, errors=errors) return render_template('teams/team.html', solves=solves, awards=awards, team=team, score=score, place=place, score_frozen=config.is_scoreboard_frozen())
def scoreboard_listing(): infos = get_infos() if config.is_scoreboard_frozen(): infos.append("Scoreboard has been frozen") if is_admin() is True and scores_visible() is False: infos.append("Scores are not currently visible to users") Model = get_model() standings = get_standings(fields=[Model.email]) category_standings = get_category_standings() return render_template( "scoreboard.html", standings=standings, category_standings=category_standings, infos=infos, email_group_asset=email_group_asset, )
def view_single_rank(): # override templates dir_path = os.path.dirname(os.path.realpath(__file__)) template_path = os.path.join(dir_path, 'assets') template_path = os.path.join(template_path, 'scoreboard.html') override_template("scoreboard.html", open(template_path).read()) # get categories categories = get_all_categories() # load scores standings = get_standings() ranks = [] for index1, category in enumerate(categories): ranks.append([]) for standing in standings: account_id = standing.account_id name = standing.name oauth_id = standing.oauth_id score = get_user_scores_for_each_category( standing.account_id, categories)[index1] ranks[index1].append([account_id, name, oauth_id, score]) ranks[index1] = sorted(ranks[index1], key=(lambda x: x[3]), reverse=True) # rank[0] account_id # rank[1] name # rank[2] oauth_id # rank[3] score return render_template("scoreboard.html", categories=categories, enumerate=enumerate, ranks=ranks, standings=standings, score_frozen=config.is_scoreboard_frozen())
def public(team_id): errors = get_errors() team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404() solves = team.get_solves() awards = team.get_awards() rfps = team.get_rfps() place = team.place score = team.score if errors: return render_template("teams/public.html", team=team, errors=errors) return render_template( "teams/public.html", solves=solves, rfps=rfps, awards=awards, team=team, score=score, place=place, score_frozen=config.is_scoreboard_frozen(), )