Order CTF by flags

This commit is contained in:
Starthur 2022-08-01 12:04:09 +02:00
parent 42858e4342
commit 121d06aff2
Signed by: Starthur
GPG Key ID: 68AD34A2CF658E32
1 changed files with 2 additions and 2 deletions

View File

@ -23,11 +23,11 @@ def actualize_points(ctf):
for s in solves:
s.user.userprofileinfo.score -= diff
s.user.userprofileinfo.save()
def category(request, cat_slug):
cat = get_object_or_404(Category, slug=cat_slug)
ctfs = CTF.objects.filter(category=cat, event=None, disabled=False).order_by('points')
ctfs = CTF.objects.filter(category=cat, event=None, disabled=False).order_by('points', 'solved_num')
for ex in ctfs:
ex.solved_num = CTF_flags.objects.filter(ctf=ex).count()
ex.solved = ex.solved_by(request.user)