From adea1f0fb47ce4154c9fa44cf08d547b6eb67363 Mon Sep 17 00:00:00 2001 From: Gustavo-SF Date: Sun, 20 Oct 2024 16:06:30 +0100 Subject: [PATCH] add submission to portal --- portal/portal/hackathons/views.py | 6 +++++- portal/portal/templates/hackathons/leaderboard.html | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/portal/portal/hackathons/views.py b/portal/portal/hackathons/views.py index 15e3f31b..e4efd510 100644 --- a/portal/portal/hackathons/views.py +++ b/portal/portal/hackathons/views.py @@ -42,7 +42,11 @@ def get( "created", ): if submission.content_object not in submissions: - submissions[submission.content_object] = submission + count = models.Submission.objects.filter( + content_type=submission.content_type, + object_id=submission.object_id, + ).count() + submissions[submission.content_object] = (submission, count) context = self.get_context_data(object=self.object, submissions=submissions) diff --git a/portal/portal/templates/hackathons/leaderboard.html b/portal/portal/templates/hackathons/leaderboard.html index 040d5597..646c6ca7 100644 --- a/portal/portal/templates/hackathons/leaderboard.html +++ b/portal/portal/templates/hackathons/leaderboard.html @@ -18,6 +18,7 @@

Leaderboard

Team Name Score + Submissions @@ -28,7 +29,8 @@

Leaderboard

{{ obj.hackathon_team_id }} {{ obj.name }} - {{ submission.score|floatformat:3 }} + {{ submission.0.score|floatformat:3 }} + {{ submission.1 }} {% endfor %}