From 121d06aff22f7c071a81f52f017c18406a06ed52 Mon Sep 17 00:00:00 2001 From: Starthur Date: Mon, 1 Aug 2022 12:04:09 +0200 Subject: [PATCH] Order CTF by flags --- src/ctfs/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ctfs/views.py b/src/ctfs/views.py index 23b38ec..24b2981 100644 --- a/src/ctfs/views.py +++ b/src/ctfs/views.py @@ -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)