mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-09 16:24:26 +01:00
* Cache the `/scoreboard` page to avoid having to rebuild the response so often * Update `tests.api.v1.test_scoreboard:test_scoreboard_is_cached` to also test if `/scoreboard` is cached
22 lines
583 B
Python
22 lines
583 B
Python
from flask import render_template, Blueprint
|
|
|
|
from CTFd.cache import cache, make_cache_key
|
|
from CTFd.utils import config
|
|
from CTFd.utils.decorators.visibility import check_score_visibility
|
|
|
|
from CTFd.utils.scores import get_standings
|
|
|
|
scoreboard = Blueprint("scoreboard", __name__)
|
|
|
|
|
|
@scoreboard.route("/scoreboard")
|
|
@check_score_visibility
|
|
@cache.cached(timeout=60, key_prefix=make_cache_key)
|
|
def listing():
|
|
standings = get_standings()
|
|
return render_template(
|
|
"scoreboard.html",
|
|
standings=standings,
|
|
score_frozen=config.is_scoreboard_frozen(),
|
|
)
|