Skip to content

Commit 2320e24

Browse files
committed
main: Add explicit sort ordering for 'LandingJobStatus' statuses using Case statement (bug 1893455)
1 parent e5c72d5 commit 2320e24

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Generated by Django 5.0.6 on 2024-05-08 18:48
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("main", "0001_initial"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="landingjob",
15+
name="status",
16+
field=models.CharField(
17+
blank=True,
18+
choices=[
19+
("SUBMITTED", "Submitted"),
20+
("IN_PROGRESS", "In progress"),
21+
("DEFERRED", "Deferred"),
22+
("FAILED", "Failed"),
23+
("LANDED", "Landed"),
24+
("CANCELLED", "Cancelled"),
25+
],
26+
default=None,
27+
max_length=32,
28+
null=True,
29+
),
30+
),
31+
]

src/lando/main/models/landing_job.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def job_queue_query(
229229
output_field=IntegerField()
230230
)
231231

232-
q = q.annotate(custom_order=ordering).order_by("-custom_order", "-priority", "created_at")
232+
q = q.annotate(status_order=ordering).order_by("-status_order", "-priority", "created_at")
233233

234234
return q
235235

0 commit comments

Comments
 (0)