From e806b23812c25b87769206d26b277e65d0c46c02 Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 3 Feb 2022 18:46:37 +0100 Subject: [PATCH] fixed latest flags when chall is disabled + fixed recompute_scoreboard --- src/home/views.py | 2 +- src/scoreboard/management/commands/recompute_scoreboard.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/home/views.py b/src/home/views.py index eace7f2..34d93f7 100644 --- a/src/home/views.py +++ b/src/home/views.py @@ -52,7 +52,7 @@ def home(request): top10 = UserProfileInfo.objects.select_related().order_by('-score', 'last_submission_date', 'user__username')[:10] nb_flags = CTF_flags.objects.count() nb_users = UserProfileInfo.objects.count() - latest_flags = CTF_flags.objects.order_by('-flag_date')[:5] + latest_flags = CTF_flags.objects.filter(ctf__event = None, ctf__disabled=False).order_by('-flag_date')[:5] top_weekly = get_weekly_top() return render(request, 'home/home.html', {'news' : news, 'ctfs' : latest_ctfs, 'top' : top10, 'flags' : nb_flags, diff --git a/src/scoreboard/management/commands/recompute_scoreboard.py b/src/scoreboard/management/commands/recompute_scoreboard.py index 380f472..1c24de4 100644 --- a/src/scoreboard/management/commands/recompute_scoreboard.py +++ b/src/scoreboard/management/commands/recompute_scoreboard.py @@ -19,8 +19,6 @@ class Command(BaseCommand): u.score = 0 u.save() - li = [(s, u) for (u, s) in scores.items()] - - for (u, s) in li: - u.userprofileinfo.score = s + for u in scores: + u.userprofileinfo.score = scores[u] u.userprofileinfo.save()