selenium-screenshot-testing
CodeKevin 2015-10-30 22:38:00 -04:00
parent 11b9039fa1
commit e659775e0d
1 changed files with 10 additions and 10 deletions

View File

@ -328,20 +328,20 @@ def admin_teams(page):
@admins_only @admins_only
def admin_team(teamid): def admin_team(teamid):
user = Teams.query.filter_by(id=teamid).first() user = Teams.query.filter_by(id=teamid).first()
solves = Solves.query.filter_by(teamid=teamid).all()
addrs = Tracking.query.filter_by(team=teamid).order_by(Tracking.date.desc()).group_by(Tracking.ip).all()
wrong_keys = WrongKeys.query.filter_by(team=teamid).order_by(WrongKeys.date.desc()).all()
score = user.score()
place = user.place()
if request.method == 'GET': if request.method == 'GET':
solves = Solves.query.filter_by(teamid=teamid).all()
addrs = Tracking.query.filter_by(team=teamid).order_by(Tracking.date.desc()).group_by(Tracking.ip).all()
wrong_keys = WrongKeys.query.filter_by(team=teamid).order_by(WrongKeys.date.desc()).all()
score = user.score()
place = user.place()
return render_template('admin/team.html', solves=solves, team=user, addrs=addrs, score=score, place=place, wrong_keys=wrong_keys) return render_template('admin/team.html', solves=solves, team=user, addrs=addrs, score=score, place=place, wrong_keys=wrong_keys)
elif request.method == 'POST': elif request.method == 'POST':
admin_user = request.form.get('admin', "false") admin_user = request.form.get('admin', None)
admin_user = 1 if admin_user == "true" else 0 if admin_user:
if admin: admin_user = 1 if admin_user == "true" else 0
user.admin = 1 user.admin = admin_user
user.banned = 1 user.banned = admin_user
db.session.commit() db.session.commit()
return jsonify({'data': ['success']}) return jsonify({'data': ['success']})