Files
CTFd/CTFd/scoreboard.py
Kevin Chung da4357b07b Make scoreboard caching only cache the score table (#1586)
* Make scoreboard caching only cache the score table instead of the entire page
* Closes #1584
2020-08-13 11:53:36 -04:00

26 lines
795 B
Python

from flask import Blueprint, render_template
from CTFd.utils import config
from CTFd.utils.config.visibility import scores_visible
from CTFd.utils.decorators.visibility import check_score_visibility
from CTFd.utils.helpers import get_infos
from CTFd.utils.scores import get_standings
from CTFd.utils.user import is_admin
scoreboard = Blueprint("scoreboard", __name__)
@scoreboard.route("/scoreboard")
@check_score_visibility
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)