diff --git a/CTFd/admin/challenges.py b/CTFd/admin/challenges.py index 079ff61..e00d4b6 100644 --- a/CTFd/admin/challenges.py +++ b/CTFd/admin/challenges.py @@ -22,7 +22,11 @@ def challenges_detail(challenge_id): Challenges.query.with_entities(Challenges.id, Challenges.name).all() ) challenge = Challenges.query.filter_by(id=challenge_id).first_or_404() - solves = Solves.query.filter_by(challenge_id=challenge.id).all() + solves = ( + Solves.query.filter_by(challenge_id=challenge.id) + .order_by(Solves.date.asc()) + .all() + ) flags = Flags.query.filter_by(challenge_id=challenge.id).all() challenge_class = get_chal_class(challenge.type) diff --git a/CTFd/admin/teams.py b/CTFd/admin/teams.py index c367cde..84e3904 100644 --- a/CTFd/admin/teams.py +++ b/CTFd/admin/teams.py @@ -90,12 +90,9 @@ def teams_detail(team_id): missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all() # Get addresses for all members - last_seen = db.func.max(Tracking.date).label("last_seen") addrs = ( - db.session.query(Tracking.ip, last_seen) - .filter(Tracking.user_id.in_(member_ids)) - .group_by(Tracking.ip) - .order_by(last_seen.desc()) + Tracking.query.filter(Tracking.user_id.in_(member_ids)) + .order_by(Tracking.date.desc()) .all() ) diff --git a/CTFd/admin/users.py b/CTFd/admin/users.py index a8fff1c..6d31b6e 100644 --- a/CTFd/admin/users.py +++ b/CTFd/admin/users.py @@ -93,13 +93,8 @@ def users_detail(user_id): missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all() # Get IP addresses that the User has used - last_seen = db.func.max(Tracking.date).label("last_seen") addrs = ( - db.session.query(Tracking.ip, last_seen) - .filter_by(user_id=user_id) - .group_by(Tracking.ip) - .order_by(last_seen.desc()) - .all() + Tracking.query.filter_by(user_id=user_id).order_by(Tracking.date.desc()).all() ) # Get Fails diff --git a/CTFd/themes/admin/templates/modals/challenges/solves.html b/CTFd/themes/admin/templates/modals/challenges/solves.html index 68832bc..6caf657 100644 --- a/CTFd/themes/admin/templates/modals/challenges/solves.html +++ b/CTFd/themes/admin/templates/modals/challenges/solves.html @@ -8,8 +8,12 @@ {% if solves is defined %} {% for solve in solves %} - - {{ solve.account.name }} + + + + {{ solve.account.name }} + + @@ -252,6 +272,7 @@ Name + User Description Date Value @@ -264,6 +285,11 @@ {% for award in awards %} {{ award.name }} + + + {{ award.user.name }} + +
{{ award.description }}
@@ -293,6 +319,7 @@

IP Addresses

+ User IP Address Last Seen @@ -300,9 +327,14 @@ {% for addr in addrs %} - {{ addr[0] }} + + + {{ addr.user.name }} + + + {{ addr.ip }} - + {% endfor %} diff --git a/CTFd/themes/admin/templates/users/user.html b/CTFd/themes/admin/templates/users/user.html index 4e9cd19..38c03aa 100644 --- a/CTFd/themes/admin/templates/users/user.html +++ b/CTFd/themes/admin/templates/users/user.html @@ -79,7 +79,9 @@ {% if user.team_id %}

- {{ user.team.name }} + + {{ user.team.name }} +

{% endif %} @@ -169,7 +171,11 @@ {% for solve in solves %} - {{ solve.challenge.name }} + + + {{ solve.challenge.name }} + +
{{ solve.provided }}
{{ solve.challenge.category }} {{ solve.challenge.value }} @@ -208,7 +214,9 @@ {% for fail in fails %} - {{ fail.challenge.name }} + + {{ fail.challenge.name }} +
{{ fail.provided }}
@@ -290,7 +298,11 @@ {% for challenge in missing %} - {{ challenge.name }} + + + {{ challenge.name }} + + {{ challenge.category }} {{ challenge.value }} @@ -322,9 +334,9 @@ {% for addr in addrs %} - {{ addr[0] }} + {{ addr.ip }} - + {% endfor %}