Skip to content

Commit

Permalink
Add missing PROCESSING status to DataStatus sort_order
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjerse committed Dec 12, 2024
1 parent c510864 commit 873f36a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Changed

Fixed
-----
- Add status ``DataStatus.PROCESSING`` to the sort order


===================
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated by Django 4.2.16 on 2024-12-12 08:01

from django.db import migrations, models
import resolwe.flow.models.base


class Migration(migrations.Migration):

dependencies = [
("flow", "0033_data_idx_data_status_priority"),
]

operations = [
migrations.RemoveIndex(
model_name="data",
name="idx_data_status_priority",
),
migrations.AddIndex(
model_name="data",
index=models.Index(
models.Case(
models.When(
status=resolwe.flow.models.base.DataStatus["ERROR"],
then=models.Value(0),
),
models.When(
status=resolwe.flow.models.base.DataStatus["PROCESSING"],
then=models.Value(1),
),
models.When(
status=resolwe.flow.models.base.DataStatus["UPLOADING"],
then=models.Value(2),
),
models.When(
status=resolwe.flow.models.base.DataStatus["PREPARING"],
then=models.Value(3),
),
models.When(
status=resolwe.flow.models.base.DataStatus["WAITING"],
then=models.Value(4),
),
models.When(
status=resolwe.flow.models.base.DataStatus["RESOLVING"],
then=models.Value(5),
),
models.When(
status=resolwe.flow.models.base.DataStatus["DONE"],
then=models.Value(6),
),
),
name="idx_data_status_priority",
),
),
]
1 change: 1 addition & 0 deletions resolwe/flow/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def sort_order(cls):
"""Return a priority for sorting data statuses in a collection."""
return [
cls.ERROR,
cls.PROCESSING,
cls.UPLOADING,
cls.PREPARING,
cls.WAITING,
Expand Down

0 comments on commit 873f36a

Please sign in to comment.