Parse acknowledgement files against .ZIP.TXT created by ftp app.

- Also convert the files info to upper() for comparison rather than lower
because original file names are in upper case. The unit tests contain examples of the returned lists.
This commit is contained in:
venusbb
2018-01-18 10:44:36 +00:00
parent dec8a191a3
commit 8f5a5f8105
3 changed files with 26 additions and 14 deletions

View File

@@ -490,9 +490,9 @@ def letter_raise_alert_if_no_ack_file_for_zip():
zip_file_list = []
for key in s3.get_list_of_files_by_suffix(bucket_name=current_app.config['LETTERS_PDF_BUCKET_NAME'],
subfolder=datetime.utcnow().strftime('%Y-%m-%d'),
suffix='.zip'):
zip_file_list.append(key)
subfolder=datetime.utcnow().strftime('%Y-%m-%d') + '/zips_sent',
suffix='.TXT'):
zip_file_list.append(key.upper().rstrip('.TXT'))
# get acknowledgement file
ack_file_list = []
@@ -511,13 +511,12 @@ def letter_raise_alert_if_no_ack_file_for_zip():
for zip_file in content.split('\n'): # each line
s = zip_file.split('|')
for zf in zip_file_list:
if s[0].lower() in zf.lower():
if s[0].upper() in zf:
zip_file_list.remove(zf)
else:
zip_not_today.append(s[0])
if zip_file_list:
raise NoAckFileReceived(message=zip_file_list)
if zip_not_today: