Skip to content

Commit

Permalink
feat: expose status changes to change history
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast committed Oct 14, 2024
1 parent d76f4ac commit 648a134
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
5 changes: 2 additions & 3 deletions backend/benefit/applications/services/change_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
DISABLE_DE_MINIMIS_AIDS = True
EXCLUDED_APPLICATION_FIELDS = (
"application_step",
"status",
"pay_subsidy_percent",
)

Expand Down Expand Up @@ -194,6 +193,6 @@ def get_application_change_history(application: Application) -> list:
}
]
attachment_diffs.append(change_set_base)
change_sets += attachment_diffs

change_sets = change_sets + attachment_diffs
change_sets.sort(key=lambda x: x["date"], reverse=True)
return change_sets
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ def _flatten_dict(d, parent_key="", sep="."):
]


def test_application_history_change_sets_for_handler(
request, handler_api_client, application
):
def test_application_history_change_sets(request, handler_api_client, application):
# Setup application to handling status
with freeze_time("2021-01-01") as frozen_datetime:
add_attachments_to_application(request, application)
Expand Down Expand Up @@ -143,6 +141,9 @@ def update_application(application_payload):

# Add a mock row which gets inserted when application status changes to "handling"
update_payloads.append({"change_reason": None, "handler": "Unknown user"})
update_payloads.append(
{"change_reason": None, "status": ApplicationStatus.HANDLING}
)

assert len(changes) == len(update_payloads)

Expand Down
3 changes: 3 additions & 0 deletions frontend/benefit/handler/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,9 @@
},
"handledByAhjoAutomation": {
"label": "Käsitelty Ahjo automaatiolla"
},
"status": {
"label": "Tila"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/benefit/handler/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,9 @@
},
"handledByAhjoAutomation": {
"label": "Käsitelty Ahjo automaatiolla"
},
"status": {
"label": "Tila"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/benefit/handler/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,9 @@
},
"handledByAhjoAutomation": {
"label": "Käsitelty Ahjo automaatiolla"
},
"status": {
"label": "Tila"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { APPLICATION_FIELD_KEYS } from 'benefit/handler/constants';
import {
APPLICATION_STATUSES,
ATTACHMENT_TYPES,
EMPLOYEE_KEYS,
PAY_SUBSIDY_GRANTED,
Expand Down Expand Up @@ -61,6 +62,20 @@ export const formatOrTranslateValue = (
)}`
);
}

if (
[
APPLICATION_STATUSES.HANDLING,
APPLICATION_STATUSES.RECEIVED,
APPLICATION_STATUSES.INFO_REQUIRED,
APPLICATION_STATUSES.ACCEPTED,
APPLICATION_STATUSES.REJECTED,
APPLICATION_STATUSES.CANCELLED,
].includes(value as APPLICATION_STATUSES)
) {
return t(`common:applications.list.columns.applicationStatuses.${value}`);
}

return value;
}

Expand Down

0 comments on commit 648a134

Please sign in to comment.