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 %} -{{ award.description }}
{{ solve.provided }}
{{ fail.provided }}@@ -290,7 +298,11 @@