mirror of https://github.com/JohnHammond/CTFd.git
Challenge team mode improvements (#1013)
* Sort solves in admin challenge view by date * Link to appropriate user and challenge in team, user, and challenge pagesselenium-screenshot-testing
parent
458ce2e518
commit
4983adf78a
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
<tbody id="challenge-solves-body">
|
||||
{% if solves is defined %}
|
||||
{% for solve in solves %}
|
||||
<tr>
|
||||
<td>{{ solve.account.name }}</td>
|
||||
<tr data-href="{{ generate_account_url(solve.account_id, admin=True) }}">
|
||||
<td>
|
||||
<a href="{{ generate_account_url(solve.account_id, admin=True) }}">
|
||||
{{ solve.account.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<script>
|
||||
document.write(moment("{{ solve.date | isoformat }}").local().format('MMMM Do, h:mm:ss A'))
|
||||
|
|
|
@ -174,6 +174,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<td class="text-center"><b>Challenge</b></td>
|
||||
<td class="text-center"><b>User</b></td>
|
||||
<td class="text-center"><b>Submitted</b></td>
|
||||
<td class="text-center"><b>Category</b></td>
|
||||
<td class="text-center"><b>Value</b></td>
|
||||
|
@ -184,7 +185,16 @@
|
|||
<tbody>
|
||||
{% for solve in solves %}
|
||||
<tr class="chal-solve">
|
||||
<td class="text-center chal" id="{{ solve.challenge_id }}">{{ solve.challenge.name }}</td>
|
||||
<td class="text-center chal" id="{{ solve.challenge_id }}">
|
||||
<a href="{{ url_for("admin.challenges_detail", challenge_id=solve.challenge_id) }}">
|
||||
{{ solve.challenge.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ url_for("admin.users_detail", user_id=solve.user_id) }}">
|
||||
{{ solve.user.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="flag" id="{{ solve.id }}"><pre>{{ solve.provided }}</pre></td>
|
||||
<td class="text-center">{{ solve.challenge.category }}</td>
|
||||
<td class="text-center">{{ solve.challenge.value }}</td>
|
||||
|
@ -215,6 +225,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<td class="text-center"><b>Challenge</b></td>
|
||||
<td class="text-center"><b>User</b></td>
|
||||
<td class="text-center"><b>Submitted</b></td>
|
||||
<td class="text-center"><b>Time</b></td>
|
||||
<td class="text-center"><b>Delete</b></td>
|
||||
|
@ -223,7 +234,16 @@
|
|||
<tbody>
|
||||
{% for fail in fails %}
|
||||
<tr class="chal-wrong">
|
||||
<td class="text-center chal" id="{{ fail.challenge_id }}">{{ fail.challenge.name }}</td>
|
||||
<td class="text-center chal" id="{{ fail.challenge_id }}">
|
||||
<a href="{{ url_for("admin.challenges_detail", challenge_id=fail.challenge_id) }}">
|
||||
{{ fail.challenge.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ url_for("admin.users_detail", user_id=fail.user_id) }}">
|
||||
{{ fail.user.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="flag" id="{{ fail.id }}"><pre>{{ fail.provided }}</pre></td>
|
||||
<td class="text-center solve-time">
|
||||
<script>document.write(moment("{{ fail.date|isoformat }}").local().format('MMMM Do, h:mm:ss A'))</script>
|
||||
|
@ -252,6 +272,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<td class="text-center"><b>Name</b></td>
|
||||
<td class="text-center"><b>User</b></td>
|
||||
<td class="text-center"><b>Description</b></td>
|
||||
<td class="text-center"><b>Date</b></td>
|
||||
<td class="text-center"><b>Value</b></td>
|
||||
|
@ -264,6 +285,11 @@
|
|||
{% for award in awards %}
|
||||
<tr class="award-row">
|
||||
<td class="text-center chal" id="{{ award.id }}">{{ award.name }}</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ url_for("admin.users_detail", user_id=award.user_id) }}">
|
||||
{{ award.user.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class=""><pre>{{ award.description }}</pre></td>
|
||||
<td class="text-center solve-time">
|
||||
<script>document.write(moment("{{ award.date|isoformat }}").local().format('MMMM Do, h:mm:ss A'))</script>
|
||||
|
@ -293,6 +319,7 @@
|
|||
<h3 class="text-center">IP Addresses</h3>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="text-center"><b>User</b></td>
|
||||
<td class="text-center"><b>IP Address</b></td>
|
||||
<td class="text-center"><b>Last Seen</b></td>
|
||||
</tr>
|
||||
|
@ -300,9 +327,14 @@
|
|||
<tbody>
|
||||
{% for addr in addrs %}
|
||||
<tr>
|
||||
<td class="text-center">{{ addr[0] }}</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ url_for("admin.users_detail", user_id=addr.user_id) }}">
|
||||
{{ addr.user.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">{{ addr.ip }}</td>
|
||||
<td class="text-center solve-time">
|
||||
<script>document.write(moment("{{ addr[1]|isoformat }}").local().format('MMMM Do, h:mm:ss A'))</script>
|
||||
<script>document.write(moment("{{ addr.date|isoformat }}").local().format('MMMM Do, h:mm:ss A'))</script>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -79,7 +79,9 @@
|
|||
|
||||
{% if user.team_id %}
|
||||
<h2 id="team-acc" class="text-center">
|
||||
<a href="{{ url_for('admin.teams_detail', team_id=user.team_id) }}">{{ user.team.name }}</a>
|
||||
<a href="{{ url_for('admin.teams_detail', team_id=user.team_id) }}">
|
||||
{{ user.team.name }}
|
||||
</a>
|
||||
</h2>
|
||||
{% endif %}
|
||||
|
||||
|
@ -169,7 +171,11 @@
|
|||
<tbody>
|
||||
{% for solve in solves %}
|
||||
<tr class="chal-solve">
|
||||
<td class="text-center chal" id="{{ solve.challenge_id }}">{{ solve.challenge.name }}</td>
|
||||
<td class="text-center chal" id="{{ solve.challenge_id }}">
|
||||
<a href="{{ url_for("admin.challenges_detail", challenge_id=solve.challenge_id) }}">
|
||||
{{ solve.challenge.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="flag" id="{{ solve.id }}"><pre>{{ solve.provided }}</pre></td>
|
||||
<td class="text-center">{{ solve.challenge.category }}</td>
|
||||
<td class="text-center">{{ solve.challenge.value }}</td>
|
||||
|
@ -208,7 +214,9 @@
|
|||
{% for fail in fails %}
|
||||
<tr class="chal-wrong">
|
||||
<td class="text-center chal" id="{{ fail.challenge_id }}">
|
||||
{{ fail.challenge.name }}
|
||||
<a href="{{ url_for("admin.challenges_detail", challenge_id=fail.challenge_id) }}">
|
||||
{{ fail.challenge.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="flag" id="{{ fail.id }}">
|
||||
<pre>{{ fail.provided }}</pre>
|
||||
|
@ -290,7 +298,11 @@
|
|||
<tbody>
|
||||
{% for challenge in missing %}
|
||||
<tr class="chal-solve">
|
||||
<td class="text-center chal" id="{{ challenge.id }}">{{ challenge.name }}</td>
|
||||
<td class="text-center chal" id="{{ challenge.id }}">
|
||||
<a href="{{ url_for("admin.challenges_detail", challenge_id=challenge.id) }}">
|
||||
{{ challenge.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">{{ challenge.category }}</td>
|
||||
<td class="text-center">{{ challenge.value }}</td>
|
||||
<td class="text-center">
|
||||
|
@ -322,9 +334,9 @@
|
|||
<tbody>
|
||||
{% for addr in addrs %}
|
||||
<tr>
|
||||
<td class="text-center">{{ addr[0] }}</td>
|
||||
<td class="text-center">{{ addr.ip }}</td>
|
||||
<td class="text-center solve-time">
|
||||
<script>document.write(moment("{{ addr[1]|isoformat }}").local().format('MMMM Do, h:mm:ss A'))</script>
|
||||
<script>document.write(moment("{{ addr.date|isoformat }}").local().format('MMMM Do, h:mm:ss A'))</script>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue