fixed latest flags when chall is disabled + fixed recompute_scoreboard

This commit is contained in:
Danhia 2022-02-03 18:46:37 +01:00
parent 0fbf7b77c3
commit e806b23812
2 changed files with 3 additions and 5 deletions

View File

@ -52,7 +52,7 @@ def home(request):
top10 = UserProfileInfo.objects.select_related().order_by('-score', 'last_submission_date', 'user__username')[:10] top10 = UserProfileInfo.objects.select_related().order_by('-score', 'last_submission_date', 'user__username')[:10]
nb_flags = CTF_flags.objects.count() nb_flags = CTF_flags.objects.count()
nb_users = UserProfileInfo.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() top_weekly = get_weekly_top()
return render(request, 'home/home.html', {'news' : news, 'ctfs' : latest_ctfs, 'top' : top10, 'flags' : nb_flags, return render(request, 'home/home.html', {'news' : news, 'ctfs' : latest_ctfs, 'top' : top10, 'flags' : nb_flags,

View File

@ -19,8 +19,6 @@ class Command(BaseCommand):
u.score = 0 u.score = 0
u.save() u.save()
li = [(s, u) for (u, s) in scores.items()] for u in scores:
u.userprofileinfo.score = scores[u]
for (u, s) in li:
u.userprofileinfo.score = s
u.userprofileinfo.save() u.userprofileinfo.save()