Delay update check by 12 hours each call and call update check in admin panel (#526)

This commit is contained in:
Kevin Chung
2017-12-14 17:16:37 -05:00
committed by GitHub
parent 18d6fa26d2
commit be6ec51eba
2 changed files with 29 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint
from CTFd.utils import admins_only, is_admin, cache
from CTFd.utils import admins_only, is_admin, cache, update_check
from CTFd.models import db, Teams, Solves, Awards, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, Config, DatabaseError
from CTFd import utils
@@ -60,6 +60,7 @@ def admin_graph(graph_type):
@admin_statistics.route('/admin/statistics', methods=['GET'])
@admins_only
def admin_stats():
update_check()
teams_registered = db.session.query(db.func.count(Teams.id)).first()[0]
wrong_count = WrongKeys.query.join(Teams, WrongKeys.teamid == Teams.id).filter(Teams.banned == False).count()