From 873f36acf88f50fd39b205b1fa29a8d7482de08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20Jer=C5=A1e?= Date: Wed, 11 Dec 2024 15:14:08 +0100 Subject: [PATCH] Add missing PROCESSING status to DataStatus sort_order --- docs/CHANGELOG.rst | 1 + ..._data_idx_data_status_priority_and_more.py | 54 +++++++++++++++++++ resolwe/flow/models/base.py | 1 + 3 files changed, 56 insertions(+) create mode 100644 resolwe/flow/migrations/0034_remove_data_idx_data_status_priority_and_more.py diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 7333bbf79..7052230b0 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -27,6 +27,7 @@ Changed Fixed ----- +- Add status ``DataStatus.PROCESSING`` to the sort order =================== diff --git a/resolwe/flow/migrations/0034_remove_data_idx_data_status_priority_and_more.py b/resolwe/flow/migrations/0034_remove_data_idx_data_status_priority_and_more.py new file mode 100644 index 000000000..d6440fcbb --- /dev/null +++ b/resolwe/flow/migrations/0034_remove_data_idx_data_status_priority_and_more.py @@ -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", + ), + ), + ] diff --git a/resolwe/flow/models/base.py b/resolwe/flow/models/base.py index ba22bed68..7cfb65599 100644 --- a/resolwe/flow/models/base.py +++ b/resolwe/flow/models/base.py @@ -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,