diff --git a/src/apps/api/views/competitions.py b/src/apps/api/views/competitions.py index d27a3fe5e..5c910b588 100644 --- a/src/apps/api/views/competitions.py +++ b/src/apps/api/views/competitions.py @@ -518,9 +518,14 @@ def get_leaderboard(self, request, pk): columns = [col for col in query['columns']] submissions_keys = {} for submission in query['submissions']: - # count number of entries/number of submissions for the owner of this submission for this phase - num_entries = Submission.objects.filter(owner__username=submission['owner'], phase=phase).count() + # count all submissions with no parent and count all parents without counting the children + num_entries = Submission.objects.filter( + Q(owner__username=submission['owner']) | Q(parent__owner__username=submission['owner']), + phase=phase, + ).exclude( + parent__isnull=False + ).count() # get date of last submission by the owner of this submission for this phase last_entry_date = Submission.objects.filter(owner__username=submission['owner'], phase=phase)\