Skip to content

Commit

Permalink
Merge pull request #5371 from bcgov/dev-marshal-MD-2981
Browse files Browse the repository at this point in the history
2981 - fix sql query for combining raw and ministry correspondences
  • Loading branch information
milosdes authored Aug 20, 2024
2 parents 46ddc08 + a126f5e commit 2b54f1d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ def getapplicantcorrespondencesrawrequests(cls, requestid):
created_at, createdby, sentcorrespondencemessage, parentapplicantcorrespondenceid, sentby, sent_at,
isdraft, isdeleted, isresponse, response_at
from "FOIApplicantCorrespondencesRawRequests" rawcorr
where foirawrequest_id = :requestid
where foirawrequest_id = (
SELECT foirawrequestid FROM public."FOIRequests"
WHERE foirequestid = :requestid
ORDER BY foirequestid ASC, version DESC limit 1)
OR
foirawrequest_id = :requestid
order by applicantcorrespondenceid desc, version desc"""
rs = db.session.execute(text(sql), {'requestid': requestid})
for row in rs:
Expand Down

0 comments on commit 2b54f1d

Please sign in to comment.