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
9 changes: 9 additions & 0 deletions stade/core/tests/test_leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,12 @@ def test_leaderboard_by_team(task_with_submissions, client):
assert third['approach__team__name'] == 'team_8'
assert third['approach__name'] == 'approach_1'
assert third['overall_score'] == 0.60


@pytest.mark.django_db
def test_leaderboard_invalid_task_falls_back_to_first_task(task_with_submissions, client):
resp = client.get(
f'/leaderboards/{task_with_submissions.challenge.slug}/?task=%27nvOpzp;%20AND%201=1'
)
assert resp.status_code == 200
assert resp.context['active_task'] == task_with_submissions
5 changes: 4 additions & 1 deletion stade/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def handler500(request):


def leaderboard_page(request, challenge):
task_id = request.GET.get('task')
try:
task_id = int(request.GET.get('task', ''))
except ValueError:
task_id = None
group_by = request.GET.get('group_by')

if group_by not in ['team', 'approach']:
Expand Down
Loading