Skip to content

Commit

Permalink
ICMSLST-3020 Fix workbasket timestamp field.
Browse files Browse the repository at this point in the history
Value used is the submit datetime if set and defaults to created for in
progress application.
  • Loading branch information
MattHolmes123 committed Oct 16, 2024
1 parent 18c1c2d commit 01ce2ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web/domains/workbasket/row.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _get_case_wb_row(app: ImpOrExp, user: User, is_ilb_admin: bool) -> Workbaske

r.reference = app.get_reference()

r.timestamp = app.created
r.timestamp = app.submit_datetime or app.created

r.status = app.get_status_display()

Expand Down Expand Up @@ -121,7 +121,7 @@ def _get_access_wb_row(

r.status = app.get_status_display()

r.timestamp = app.created
r.timestamp = app.submit_datetime or app.created

info_rows = ["Access Request"]

Expand Down Expand Up @@ -213,7 +213,7 @@ def _get_approval_wb_row(

r.status = app.get_status_display()

r.timestamp = app.created
r.timestamp = app.request_date or app.created

information = "Approval Request"

Expand Down
8 changes: 8 additions & 0 deletions web/tests/domains/workbasket/test_row.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import datetime as dt

import pytest
from django.test import override_settings

Expand Down Expand Up @@ -29,6 +31,8 @@ def app_in_progress(db, importer, importer_one_contact):
@pytest.fixture
def app_submitted(db, importer, importer_one_contact):
app = _create_wood_app(importer, importer_one_contact, ImpExpStatus.SUBMITTED)
app.submit_datetime = dt.datetime.now()
app.save()
return _get_wood_app_with_annotations(app)


Expand Down Expand Up @@ -64,6 +68,8 @@ def test_actions_in_progress(app_in_progress, importer_one_contact):
get_row = get_workbasket_row_func(app_in_progress.process_type)
user_row = get_row(app_in_progress, importer_one_contact, False)

assert user_row.timestamp == app_in_progress.created

_check_actions(user_row.sections, expected_actions={"Resume", "Cancel"})


Expand All @@ -72,6 +78,8 @@ def test_actions_submitted(app_submitted, importer_one_contact):

user_row = get_row(app_submitted, importer_one_contact, False)

assert user_row.timestamp == app_submitted.submit_datetime

_check_actions(user_row.sections, expected_actions={"Withdraw", "View Application"})


Expand Down

0 comments on commit 01ce2ac

Please sign in to comment.