Skip to content

Commit

Permalink
Fix observation 14 in FOIMOD-3300
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-aot committed Jul 24, 2024
1 parent 2a8a92c commit 71b8dad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions api/reviewer_api/resources/foiflowmasterdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class FOIFlowS3PresignedRedline(Resource):
def post(ministryrequestid, redactionlayer="redline", layertype="redline"):
try:
data = request.get_json()
requesttype = data["divdocumentList"]
requesttype = data["requestType"]
documentmapper = redactionservice().getdocumentmapper(
data["divdocumentList"][0]["documentlist"][0]["filepath"].split("/")[3]
)
Expand All @@ -199,11 +199,14 @@ def post(ministryrequestid, redactionlayer="redline", layertype="redline"):
packagetype = "redline"
if redactionlayer == "oipc":
packagetype = "oipcreview" if layertype == "oipcreview" else "oipcredline"

#check if is single redline package
is_single_redline = is_single_redline_package(_bcgovcode, packagetype, requesttype)

for div in data["divdocumentList"]:
if len(div["documentlist"]) > 0:
filepathlist = div["documentlist"][0]["filepath"].split("/")[4:]
if is_single_redline_package(_bcgovcode, packagetype, requesttype) == False:
if is_single_redline == False:
division_name = div["divisionname"]
# generate save url for stitched file
filepath_put = "{0}/{2}/{1}/{0} - {2} - {1}.pdf".format(
Expand Down Expand Up @@ -261,7 +264,7 @@ def post(ministryrequestid, redactionlayer="redline", layertype="redline"):
)
elif len(div["incompatableList"]) > 0:
filepathlist = div["incompatableList"][0]["filepath"].split("/")[4:]
if is_single_redline_package(_bcgovcode, packagetype, requesttype) and singlepkgpath is None :
if is_single_redline and singlepkgpath is None :
if len(div["documentlist"]) > 0 or len(div["incompatableList"]) > 0:
div = data["divdocumentList"][0]
filepathlist = div["documentlist"][0]["filepath"].split("/")[4:]
Expand All @@ -282,7 +285,7 @@ def post(ministryrequestid, redactionlayer="redline", layertype="redline"):
singlepkgpath = s3path_save
data["s3path_save"] = s3path_save

if is_single_redline_package(_bcgovcode, packagetype, requesttype):
if is_single_redline:
for div in data["divdocumentList"]:
if len(div["documentlist"]) > 0:
documentlist_copy = div["documentlist"][:]
Expand All @@ -301,7 +304,7 @@ def post(ministryrequestid, redactionlayer="redline", layertype="redline"):

data["requestnumber"] = filepathlist[0]
data["bcgovcode"] = _bcgovcode
data["issingleredlinepackage"] = "Y" if is_single_redline_package(_bcgovcode, packagetype, requesttype) else "N"
data["issingleredlinepackage"] = "Y" if is_single_redline else "N"
return json.dumps(data), 200
except BusinessException as exception:
return {"status": exception.status_code, "message": exception.message}, 500
Expand Down
2 changes: 1 addition & 1 deletion api/reviewer_api/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ def is_single_redline_package(bcgovcode, packagetype, requesttype):
return True
if REDLINE_SINGLE_PKG_MINISTRIES_PERSONAL not in (None, ""):
_pkg_ministries_personal = REDLINE_SINGLE_PKG_MINISTRIES_PERSONAL.replace(" ", "").split(',')
if bcgovcode.upper() in _pkg_ministries_personal:
if bcgovcode.upper() in _pkg_ministries_personal and requesttype.upper() == "PERSONAL":
return True
return False

0 comments on commit 71b8dad

Please sign in to comment.