Merge pull request #2605 from alphagov/fix-get-pdf-using-created_at-date

Fix the folder returned for a pdf letter.
This commit is contained in:
Rebecca Law
2019-09-05 14:21:02 +01:00
committed by GitHub
2 changed files with 19 additions and 1 deletions

View File

@@ -58,7 +58,10 @@ def get_bucket_name_and_prefix_for_notification(notification):
bucket_name = current_app.config['TEST_LETTERS_BUCKET_NAME']
else:
bucket_name = current_app.config['LETTERS_PDF_BUCKET_NAME']
folder = get_folder_name(notification.created_at, False)
if notification.sent_at:
folder = "{}/".format(notification.sent_at.date())
else:
folder = get_folder_name(notification.updated_at, False)
upload_file_name = PRECOMPILED_BUCKET_PREFIX.format(
folder=folder,