Skip to content

Commit

Permalink
oipc merge
Browse files Browse the repository at this point in the history
  • Loading branch information
sumathi.thirumani committed Jan 18, 2024
2 parents 971eb7a + 243048e commit 7398dda
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ def getaxisrequestidforrequest(cls,requestid, ministryrequestid):
def getmetadata(cls,ministryrequestid):
requestdetails = {}
try:
sql = """select fmr.version, assignedto, fa.firstname, fa.lastname, pa.bcgovcode, fmr.programareaid, f.requesttype
sql = """select fmr.version, assignedto, fa.firstname, fa.lastname, pa.bcgovcode, fmr.programareaid, f.requesttype, fmr.isoipcreview
from "FOIMinistryRequests" fmr join "FOIRequests" f on fmr.foirequest_id = f.foirequestid and fmr.foirequestversion_id = f."version"
FULL OUTER JOIN "FOIAssignees" fa ON fa.username = fmr.assignedto
INNER JOIN "ProgramAreas" pa ON pa.programareaid = fmr.programareaid
Expand All @@ -1379,6 +1379,7 @@ def getmetadata(cls,ministryrequestid):
requestdetails["version"] = row["version"]
requestdetails["programareaid"] = row["programareaid"]
requestdetails["requesttype"] = row["requesttype"]
requestdetails["isoipcreview"] = row["isoipcreview"]
except Exception as ex:
logging.error(ex)
raise ex
Expand Down
8 changes: 6 additions & 2 deletions request-management-api/request_api/services/events/oipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ class oipcevent:
"""

def createoipcevent(self, requestid, userid):
ministryrequest = FOIMinistryRequest.getmetadata(requestid)
if ministryrequest["isoipcreview"] in (None, False):
notificationservice().dismissnotifications_by_requestid_type(requestid, "ministryrequest", self.__notificationtype())
return DefaultMethodResult(True,'No change',requestid)
inquiryoutcomes = oipcservice().getinquiryoutcomes()
version = FOIMinistryRequest.getversionforrequest(requestid)
version = ministryrequest["version"]
curoipcs = FOIRequestOIPC.getoipc(requestid, version)
prevoipcs = FOIRequestOIPC.getoipc(requestid, version[0]-1)
prevoipcs = FOIRequestOIPC.getoipc(requestid, version-1)
oipcsummary = self.__maintained(curoipcs, prevoipcs, inquiryoutcomes)
if oipcsummary is None or (oipcsummary and len(oipcsummary) <1):
return DefaultMethodResult(True,'No change',requestid)
Expand Down
11 changes: 11 additions & 0 deletions request-management-api/request_api/services/notificationservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ def dismissnotifications_by_requestid_type_userid(self, requestid, requesttype,
_ids = FOIRawRequestNotification.getnotificationidsbynumberandtype('U-00' + str(foirequest['requestid']), notificationtypelabels[0])
self.__deletenotificationbyuserandid(requesttype, _ids, userid)

def dismissnotifications_by_requestid_type(self, requestid, requesttype, notificationtype):
notificationtypelabels = self.__getcleanupnotificationids(notificationtype)
foirequest = self.getrequest(requestid, requesttype)
if requesttype == "ministryrequest":
idnumber = foirequest["filenumber"]
_ids = FOIRequestNotification.getnotificationidsbynumberandtype(idnumber, notificationtypelabels)
else:
_ids = FOIRawRequestNotification.getnotificationidsbynumberandtype('U-00' + str(foirequest['requestid']), notificationtypelabels[0])
self.__deletenotificationids(requesttype, _ids)


def __createnotification(self, message, requestid, requesttype, notificationtype, userid, foirequest, requestjson=None):
notification = self.__preparenotification(message, requesttype, notificationtype, userid, foirequest, requestjson)
if notification is not None:
Expand Down

0 comments on commit 7398dda

Please sign in to comment.