This fixes a bug where the folder name was not correctly returning the right date because date used to compare was in UTC but the datetime used for the job start time is in BST.

Units tests have been added for the affected method.
This commit is contained in:
Rebecca Law
2018-05-30 10:18:37 +01:00
parent 369865cd82
commit 41f3293cd5
2 changed files with 23 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ from flask import current_app
from notifications_utils.s3 import s3upload
from app.models import KEY_TYPE_TEST
from app.utils import convert_utc_to_bst
from app.variables import Retention
@@ -26,7 +27,7 @@ def get_folder_name(_now, is_test_or_scan_letter=False):
folder_name = ''
else:
print_datetime = _now
if _now.time() > current_app.config.get('LETTER_PROCESSING_DEADLINE'):
if convert_utc_to_bst(_now).time() > current_app.config.get('LETTER_PROCESSING_DEADLINE'):
print_datetime = _now + timedelta(days=1)
folder_name = '{}/'.format(print_datetime.date())
return folder_name