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
22 changes: 22 additions & 0 deletions stade/core/migrations/0015_add_position_to_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.2.5 on 2025-08-19 20:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0014_alter_task_metric_field'),
]

operations = [
migrations.AlterModelOptions(
name='task',
options={'ordering': ['position', 'id']},
),
migrations.AddField(
model_name='task',
name='position',
field=models.PositiveSmallIntegerField(default=0),
),
]
3 changes: 2 additions & 1 deletion stade/core/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class Task(models.Model):
class Meta:
ordering = ['id']
ordering = ['position', 'id']

class Type(models.TextChoices):
SEGMENTATION = 'segmentation', _('Segmentation')
Expand Down Expand Up @@ -72,6 +72,7 @@ class MetricField(models.TextChoices):
help_text='Whether approaches should require a manuscript.',
)
test_ground_truth_file = S3FileField()
position = models.PositiveSmallIntegerField(default=0)

# Define custom "objects" first, so it will be the "_default_manager", which is more efficient
# for many automatically generated queries
Expand Down
2 changes: 1 addition & 1 deletion stade/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def leaderboard_page(request, challenge):
if group_by not in ['team', 'approach']:
group_by = 'team' if challenge.slug != 'live' else 'approach'

tasks = challenge.tasks.filter(scores_published=True).order_by('name')
tasks = challenge.tasks.filter(scores_published=True).order_by('position')

if not request.user.is_staff:
tasks = tasks.filter(hidden=False)
Expand Down