Skip to content

Commit

Permalink
Revised docreviewer backend getdocuments to consume bcgovcode to gath…
Browse files Browse the repository at this point in the history
…er divisons for recrods based on bcgovcode from foi-flow backend. More efficient call than gathering all divs. Ticket completed
  • Loading branch information
Aman-Hundal committed Sep 12, 2023
1 parent 31af913 commit 6e94ebf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion api/reviewer_api/resources/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def get(requestid):
timeout=float(requestapitimeout)
)
response.raise_for_status()
result = documentservice().getdocuments(requestid)
bcgovcode = response.json()['bcgovcode']
result = documentservice().getdocuments(requestid,bcgovcode)
return json.dumps(result), 200
except KeyError as err:
return {'status': False, 'message':err.messages}, 400
Expand Down
6 changes: 3 additions & 3 deletions api/reviewer_api/services/documentservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ def updatedocumentattributes(self, payload, userid):

return DocumentAttributes.update(newRows, oldRows)

def getdocuments(self, requestid):
def getdocuments(self, requestid,bcgovcode):
divisions_data = requests.request(
method='GET',
url=requestapiurl + "/api/foiflow/divisions",
url=requestapiurl + "/api/foiflow/divisions/{0}".format(bcgovcode),
headers={'Authorization': AuthHelper.getauthtoken(), 'Content-Type': 'application/json'}
).json()
divisions = {div['divisionid']: div for div in divisions_data}
divisions = {div['divisionid']: div for div in divisions_data['divisions']}

documents = {document['documentmasterid']: document for document in self.getdedupestatus(requestid)}
attachments = []
Expand Down

0 comments on commit 6e94ebf

Please sign in to comment.