Skip to content

Commit 0f794e0

Browse files
emilteMorten Madsen Lyngstad
authored andcommitted
Change status Confirmed to Delivered. (#80)
1 parent 085e130 commit 0f794e0

File tree

6 files changed

+39
-9
lines changed

6 files changed

+39
-9
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated by Django 5.2.3 on 2025-06-19 15:26
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("genlab_bestilling", "0013_location_comment_alter_location_river_id"),
9+
]
10+
11+
operations = [
12+
migrations.AlterField(
13+
model_name="order",
14+
name="status",
15+
field=models.CharField(
16+
choices=[
17+
("draft", "Draft"),
18+
("confirmed", "Delivered"),
19+
("processing", "Processing"),
20+
("completed", "Completed"),
21+
],
22+
default="draft",
23+
),
24+
),
25+
]

src/genlab_bestilling/models.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,19 @@ class CannotConfirm(ValidationError):
228228
pass
229229

230230
class OrderStatus(models.TextChoices):
231+
# DRAFT: External researcher has created the order, and is currently working on it before having it delivered for processing. # noqa: E501
231232
DRAFT = "draft", _("Draft")
232-
CONFIRMED = "confirmed", _("Confirmed")
233+
# DELIVERED: Order has been delivered from researcher to the NINA staff.
234+
# NOTE: # The old value `confirmed` was preserved during a name change to avoid migration issues. The primary goal is to have a more descriptive name for staff users in the GUI. # noqa: E501
235+
DELIVERED = "confirmed", _("Delivered")
236+
# PROCESSING: NINA staff has begun processing the order.
233237
PROCESSING = "processing", _("Processing")
238+
# COMPLETED: Order has been completed, and results are available.
234239
COMPLETED = "completed", _("Completed")
235240

236241
STATUS_ORDER = (
237242
OrderStatus.DRAFT,
238-
OrderStatus.CONFIRMED,
243+
OrderStatus.DELIVERED,
239244
OrderStatus.PROCESSING,
240245
OrderStatus.COMPLETED,
241246
)
@@ -258,7 +263,7 @@ class OrderStatus(models.TextChoices):
258263
objects = managers.OrderManager()
259264

260265
def confirm_order(self):
261-
self.status = Order.OrderStatus.CONFIRMED
266+
self.status = Order.OrderStatus.DELIVERED
262267
self.confirmed_at = timezone.now()
263268
self.save()
264269

src/genlab_bestilling/templates/genlab_bestilling/analysisorder_detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h5 class="text-2xl my-5">Samples to analyze</h5>
4545
{% action-button action=confirm_order_url class="bg-secondary text-white" submit_text="Confirm Order" csrf_token=csrf_token %}
4646
{% action-button action=clone_order_url class="bg-secondary text-white" submit_text="Clone Order" csrf_token=csrf_token %}
4747
<a class="btn bg-red-500 text-white" href="{% url 'genrequest-analysis-delete' genrequest_id=object.genrequest_id pk=object.id %}">Delete</a>
48-
{% elif object.status == 'confirmed' %}
48+
{% elif object.status == object.OrderStatus.DELIVERED %}
4949
<a class="btn bg-primary" href="{% url 'genrequest-analysis-samples' genrequest_id=object.genrequest_id pk=object.id %}">Samples</a>
5050
{% endif %}
5151
</div>

src/staff/templates/staff/analysisorder_detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h5 class="text-2xl my-5">Samples to analyze</h5>
2727
<div class="flex gap-5 my-5">
2828
<a class="btn bg-yellow-200" href="{% url 'staff:order-analysis-list' %}"><i class="fas fa-arrow-left"></i> back</a>
2929
<a class="btn bg-primary" href="{% url 'staff:order-analysis-samples' pk=object.id %}">Samples</a>
30-
{% if object.status == 'confirmed' %}
30+
{% if object.status == object.OrderStatus.DELIVERED %}
3131
<div class="ml-auto"></div>
3232
{% url 'staff:order-to-draft' pk=object.id as to_draft_url %}
3333
{% action-button action=to_draft_url class="bg-secondary text-white" submit_text="Convert to draft" csrf_token=csrf_token %}

src/staff/templates/staff/extractionorder_detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h5 class="text-2xl my-5">Delivered Samples</h5>
2727
<div class="flex gap-5 my-5">
2828
<a class="btn bg-yellow-200" href="{% url 'staff:order-extraction-list' %}"><i class="fas fa-arrow-left"></i> back</a>
2929
<a class="btn bg-primary" href="{% url 'staff:order-extraction-samples' pk=object.id %}">Samples</a>
30-
{% if object.status == 'confirmed' %}
30+
{% if object.status == object.OrderStatus.DELIVERED %}
3131
<div class="ml-auto"></div>
3232
{% url 'staff:order-manually-checked' pk=object.id as confirm_check_url %}
3333
{% url 'staff:order-to-draft' pk=object.id as to_draft_url %}

src/staff/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class ManaullyCheckedOrderActionView(SingleObjectMixin, ActionView):
258258
model = ExtractionOrder
259259

260260
def get_queryset(self):
261-
return ExtractionOrder.objects.filter(status=Order.OrderStatus.CONFIRMED)
261+
return ExtractionOrder.objects.filter(status=Order.OrderStatus.DELIVERED)
262262

263263
def post(self, request, *args, **kwargs):
264264
self.object = self.get_object()
@@ -296,7 +296,7 @@ class OrderToDraftActionView(SingleObjectMixin, ActionView):
296296
model = Order
297297

298298
def get_queryset(self):
299-
return super().get_queryset().filter(status=Order.OrderStatus.CONFIRMED)
299+
return super().get_queryset().filter(status=Order.OrderStatus.DELIVERED)
300300

301301
def post(self, request, *args, **kwargs):
302302
self.object = self.get_object()
@@ -382,7 +382,7 @@ def get_queryset(self):
382382
super()
383383
.get_queryset()
384384
.select_related("order")
385-
.filter(order__status=Order.OrderStatus.CONFIRMED)
385+
.filter(order__status=Order.OrderStatus.DELIVERED)
386386
)
387387

388388
def post(self, request, *args, **kwargs):

0 commit comments

Comments
 (0)