From d04fd0f5bf347eb8c99908f6d564d620d0b52879 Mon Sep 17 00:00:00 2001 From: CodeKevin Date: Mon, 23 May 2016 20:20:39 -0400 Subject: [PATCH] Users with no awards --- CTFd/challenges.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CTFd/challenges.py b/CTFd/challenges.py index acabb143..f01bd7cc 100644 --- a/CTFd/challenges.py +++ b/CTFd/challenges.py @@ -90,15 +90,16 @@ def solves(teamid=None): 'category': solve.chal.category, 'time': unix_time(solve.date) }) - for award in awards: - json['solves'].append({ - 'chal': award.name, - 'chalid': None, - 'team': award.teamid, - 'value': award.value, - 'category': award.category, - 'time': unix_time(award.date) - }) + if awards: + for award in awards: + json['solves'].append({ + 'chal': award.name, + 'chalid': None, + 'team': award.teamid, + 'value': award.value, + 'category': award.category, + 'time': unix_time(award.date) + }) json['solves'].sort(key=lambda k: k['time']) return jsonify(json)