Skip to content

Commit

Permalink
Merge pull request #2353 from uktrade/LTD-5899-Add-time-on-queue-sort…
Browse files Browse the repository at this point in the history
…ing-option

LTD-5899: Add option in FE to sort based on when a queue is assigned to a case
  • Loading branch information
saruniitr authored Feb 11, 2025
2 parents e017500 + f839e7d commit 695fb5f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
20 changes: 20 additions & 0 deletions caseworker/advice/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@
NCSC_CASES_TO_REVIEW,
)

CASE_PROGRESSION_QUEUES = [
DESNZ_NUCLEAR_CASES_TO_REVIEW,
DESNZ_NUCLEAR_COUNTERSIGNING,
DESNZ_CHEMICAL_CASES_TO_REVIEW,
DESNZ_RUSSIA_SANCTIONS,
FCDO_CASES_TO_REVIEW_QUEUE,
FCDO_COUNTERSIGNING_QUEUE,
FCDO_CPACC_CASES_TO_REVIEW_QUEUE,
LU_POST_CIRC_FINALISE_QUEUE,
LU_LICENSING_MANAGER_QUEUE,
LU_SR_LICENSING_MANAGER_QUEUE,
MOD_CAPPROT_CASES_TO_REVIEW,
MOD_DI_DIRECT_CASES_TO_REVIEW,
MOD_DI_INDIRECT_CASES_TO_REVIEW,
MOD_DSR_CASES_TO_REVIEW,
MOD_DSTL_CASES_TO_REVIEW,
MOD_ECJU_REVIEW_AND_COMBINE,
NCSC_CASES_TO_REVIEW,
]

DECISION_TYPE_VERB_MAPPING = {
"Approve": "approved",
"Proviso": "approved",
Expand Down
11 changes: 11 additions & 0 deletions caseworker/queues/views/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from django import forms
from django.urls import reverse

from caseworker.advice.constants import CASE_PROGRESSION_QUEUES
from core.constants import LicenceStatusEnum


Expand Down Expand Up @@ -142,6 +144,15 @@ def __init__(self, queue, filters_data, all_flags, all_cles, all_regimes, countr
("-submitted_at", "Submitted (newest to oldest)"),
("submitted_at", "Submitted (oldest to newest)"),
]

if queue["id"] in CASE_PROGRESSION_QUEUES:
sort_options.extend(
[
("-time_on_queue", "Time on queue (newest to oldest)"),
("time_on_queue", "Time on queue (oldest to newest)"),
]
)

self.fields["sort_by"] = forms.ChoiceField(
choices=sort_options,
label="Sort by",
Expand Down
4 changes: 3 additions & 1 deletion unit_tests/caseworker/cases/views/test_case_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ def setup(
({"field": "finalised_to", "params": {"finalised_to_0": "1", "finalised_to_1": "1", "finalised_to_2": "2022"}}),
({"params": {"export_type": "permanent", "assigned_queues": "fake-queue-id-1"}}),
({"params": {"case_type": "siel", "sub_status": "inform_letter_sent"}}),
({"params": {"sort_by": "submitted_at"}}),
({"params": {"sort_by": "-submitted_at"}}),
({"params": {"sort_by": "submitted_at"}}),
({"params": {"sort_by": "-time_on_queue"}}),
({"params": {"sort_by": "time_on_queue"}}),
],
)
def test_case_filters_and_sort(
Expand Down

0 comments on commit 695fb5f

Please sign in to comment.