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)