Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions src/apps/api/views/competitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ 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()

# 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)\
.values('created_when')\
.order_by('-created_when')[0]['created_when']\
.strftime('%Y-%m-%d')

submission_key = f"{submission['owner']}{submission['parent'] or submission['id']}"
if submission_key not in submissions_keys:
submissions_keys[submission_key] = len(response['submissions'])
Expand All @@ -511,6 +521,8 @@ def get_leaderboard(self, request, pk):
'fact_sheet_answers': submission['fact_sheet_answers'],
'slug_url': submission['slug_url'],
'organization': submission['organization'],
'num_entries': num_entries,
'last_entry_date': last_entry_date
})
for score in submission['scores']:

Expand Down
8 changes: 6 additions & 2 deletions src/static/riot/competitions/detail/leaderboards.tag
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
</tr>
<tr class="task-row">
<th>Task:</th>
<th></th>
<th colspan=3></th>
<th each="{ task in filtered_tasks }" class="center aligned" colspan="{ task.colWidth }">{ task.name }</th>
<th if="{enable_detailed_results}"></th>
</tr>
<tr>
<th class="center aligned">#</th>
<th>Participant</th>
<th class="center aligned" each="{ column in filtered_columns }" colspan="1">{column.title}</th>
<th>Entries</th>
<th>Date of last entry</th>
<th each="{ column in filtered_columns }" colspan="1">{column.title}</th>
<th if="{enable_detailed_results}">Detailed Results</th>
</tr>
</thead>
Expand All @@ -55,6 +57,8 @@
<virtual if="{index + 1 > 5}">{index + 1}</virtual>
</td>
<td if="{submission.organization === null}"><a href="{submission.slug_url}">{ submission.owner }</a></td>
<td>{submission.num_entries}</td>
<td>{submission.last_entry_date}</td>
<td if="{submission.organization !== null}"><a href="{submission.organization.url}">{ submission.organization.name }</a></td>
<td each="{ column in filtered_columns }">{ get_score(column, submission) } </td>
<td if="{enable_detailed_results}"><a href="detailed_results/{submission.id}" target="_blank">Show detailed results</a></td>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/functional/test_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _run_submission_and_add_to_leaderboard(self, competition_zip_path, submissio

# The leaderboard table lists our submission
prediction_score = Submission.objects.get(pk=submission_id).scores.first().score
assert Decimal(self.find('leaderboards table tbody tr:nth-of-type(1) td:nth-of-type(3)').text) == round(Decimal(prediction_score), precision)
assert Decimal(self.find('leaderboards table tbody tr:nth-of-type(1) td:nth-of-type(5)').text) == round(Decimal(prediction_score), precision)

def test_v15_iris_result_submission_end_to_end(self):
self._run_submission_and_add_to_leaderboard('competition_15_iris.zip', 'submission_15_iris_result.zip', '======= Set 1 (Iris_test)', has_solutions=False, precision=4)
Expand Down