Skip to content

Commit

Permalink
Handle undefined requestids from frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
milosdes committed Aug 20, 2024
1 parent 4233f29 commit 9838753
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions request-management-api/request_api/models/FOIRequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def getrawrequestidbyfoirequestid(cls,requestid)->DefaultMethodResult:
where fr.foirequestid=:requestid
order by fr."version" desc limit 1"""
rs = db.session.execute(text(sql), {'requestid': requestid})
rawrequestid = None
for row in rs:
rawrequestid = row["foirawrequestid"]
except Exception as ex:
Expand Down
2 changes: 2 additions & 0 deletions request-management-api/request_api/services/requestservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def getrequest(self, foirequestid, foiministryrequestid):
return requestservicegetter().getrequest(foirequestid, foiministryrequestid)

def getrawrequestidbyfoirequestid(self, foirequestid):
if foirequestid == 'undefined':
return None
rawrequestid = requestservicegetter().getrawrequestidbyfoirequestid(foirequestid)
if rawrequestid is None:
rawrequestid = foirequestid
Expand Down

0 comments on commit 9838753

Please sign in to comment.