fixed error when displaying challenge info in solo mode

This commit is contained in:
Danhia 2022-01-02 21:53:38 +01:00
parent eb23c9fac8
commit 39d10437f8
2 changed files with 5 additions and 2 deletions

View File

@ -76,7 +76,7 @@
{% for s in solved_list %}
{% if event.team_size == 1%}
<tr>
<th scope="row"><a class="profile_link" href="{% url 'events:profile' user_name=s.user.username %}"> {{ s.0.username }}</a></th>
<th scope="row"><a class="profile_link" href="{% url 'events:profile' user_name=s.0.username event_slug=event.slug %}"> {{ s.0.username }}</a></th>
<td>{{ s.0.userprofileinfo.portfolio_site }}</td>
<td>{{ s.1 }}</td>
</tr>

View File

@ -61,7 +61,10 @@ def chall_event_info(request, event_slug, chall_slug):
solved_challs = CTF_flags.objects.filter(ctf=ctf_info).order_by('flag_date')
solved_list = []
for s in solved_challs:
solved_list.append([s.user, s.flag_date, EventPlayer.objects.get(event=event_info, user=s.user).team.name])
if event_info.team_size > 1:
solved_list.append([s.user, s.flag_date, EventPlayer.objects.get(event=event_info, user=s.user).team.name])
else:
solved_list.append([s.user, s.flag_date])
description = get_description_by_lang(ctf_info)
return render(request, 'events/ctf_info.html', { 'ctf' : ctf_info, 'event':event_info, 'solved_list': solved_list, 'description': description, 'eventisover': eventisover, 'alreadyflag': alreadyflag,
'congrat': congrat, 'wrongflag': wrongflag, 'errorform': errorform, 'notsub': notsub})