From 30e6474325269dbe075fa91039131a6245e19f2e Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Dec 2023 13:48:11 -0800 Subject: [PATCH 1/2] Changes to send reminder notifications; only when outcome is not taken. --- .../request_api/models/FOIMinistryRequests.py | 2 ++ .../services/foirequest/requestservicebuilder.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/request-management-api/request_api/models/FOIMinistryRequests.py b/request-management-api/request_api/models/FOIMinistryRequests.py index 7d45eb6e2..acf0f870f 100644 --- a/request-management-api/request_api/models/FOIMinistryRequests.py +++ b/request-management-api/request_api/models/FOIMinistryRequests.py @@ -808,6 +808,8 @@ def getupcomingoipcduerecords(cls): from "FOIMinistryRequests" fpa order by fpa.foiministryrequestid , fpa.version desc) fma on frd.foiministryrequest_id = fma.foiministryrequestid and frd.foiministryrequestversion_id = fma.foiministryrequestversion and fma.requeststatusid not in (5,6,4,11,3,15) + and inquiryattributes is not null + and frd.inquiryattributes ->> 'inquirydate' not in ('','null') and (frd.inquiryattributes ->> 'inquirydate')::date between NOW() - INTERVAL '7 DAY' AND NOW() + INTERVAL '7 DAY' and frd.outcomeid is null order by frd.foiministryrequest_id , frd.foiministryrequestversion_id desc;""" diff --git a/request-management-api/request_api/services/foirequest/requestservicebuilder.py b/request-management-api/request_api/services/foirequest/requestservicebuilder.py index dd1a0516b..bb1fbc262 100644 --- a/request-management-api/request_api/services/foirequest/requestservicebuilder.py +++ b/request-management-api/request_api/services/foirequest/requestservicebuilder.py @@ -152,11 +152,18 @@ def prepareoipc(self, requestschema, ministryrequestid, version, userid): oipcreview.receiveddate = oipc["receiveddate"] if oipc["receiveddate"] not in (None, "") else None oipcreview.closeddate = oipc["closeddate"] if oipc["closeddate"] not in (None, "") else None if oipc["isinquiry"] == True: - oipcreview.inquiryattributes = oipc["inquiryattributes"] + oipcreview.inquiryattributes = self.__formatoipcattributes(oipc["inquiryattributes"]) oipcreview.createdby=userid oipcreview.created_at= datetime2.now().isoformat() oipcarr.append(oipcreview) return oipcarr + + def __formatoipcattributes(self, inquiryattributes): + if inquiryattributes not in (None, ""): + if (inquiryattributes["inquirydate"]) in ("","null"): + inquiryattributes["inquirydate"] = None + print(inquiryattributes) + return inquiryattributes def isNotBlankorNone(self, dataschema, key, location): From 4e10941163c4ffca73900eca050e46b2a0321417 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Dec 2023 13:54:11 -0800 Subject: [PATCH 2/2] Changes to send reminder notifications; only when outcome is not taken. --- .../services/foirequest/requestservicebuilder.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/request-management-api/request_api/services/foirequest/requestservicebuilder.py b/request-management-api/request_api/services/foirequest/requestservicebuilder.py index bb1fbc262..eef873754 100644 --- a/request-management-api/request_api/services/foirequest/requestservicebuilder.py +++ b/request-management-api/request_api/services/foirequest/requestservicebuilder.py @@ -159,10 +159,8 @@ def prepareoipc(self, requestschema, ministryrequestid, version, userid): return oipcarr def __formatoipcattributes(self, inquiryattributes): - if inquiryattributes not in (None, ""): - if (inquiryattributes["inquirydate"]) in ("","null"): - inquiryattributes["inquirydate"] = None - print(inquiryattributes) + if inquiryattributes not in (None, "") and inquiryattributes["inquirydate"] in ("","null"): + inquiryattributes["inquirydate"] = None return inquiryattributes