Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/apps/api/views/competitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)\
Expand Down