From 775ea76c3da17f0a7bf45672e6729fcacfe2037f Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 14 Dec 2023 16:46:37 -0800 Subject: [PATCH] Adjusted model method getstatehistory to incl created_at times --- .../request_api/models/FOIMinistryRequests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/models/FOIMinistryRequests.py b/request-management-api/request_api/models/FOIMinistryRequests.py index dc25bc8ac..0c43b1538 100644 --- a/request-management-api/request_api/models/FOIMinistryRequests.py +++ b/request-management-api/request_api/models/FOIMinistryRequests.py @@ -257,13 +257,13 @@ def getstatesummary(cls, ministryrequestid): sql =select status, version from (select distinct name as status, version from "FOIMinistryRequests" fm inner join "FOIRequestStatuses" fs2 on fm.requeststatusid = fs2.requeststatusid where foiministryrequestid=:ministryrequestid order by version asc) as fs3 order by version desc; """ - sql = """select fm2.version, fs2."name" as status from "FOIMinistryRequests" fm2 inner join "FOIRequestStatuses" fs2 on fm2.requeststatusid = fs2.requeststatusid + sql = """select fm2.version, fs2."name" as status, fm2.created_at from "FOIMinistryRequests" fm2 inner join "FOIRequestStatuses" fs2 on fm2.requeststatusid = fs2.requeststatusid where fm2.foiministryrequestid=:ministryrequestid order by version desc""" rs = db.session.execute(text(sql), {'ministryrequestid': ministryrequestid}) _tmp_state = None for row in rs: if row["status"] != _tmp_state: - transitions.append({"status": row["status"], "version": row["version"]}) + transitions.append({"status": row["status"], "version": row["version"], "created_at": row["created_at"]}) _tmp_state = row["status"] except Exception as ex: logging.error(ex)