Merge pull request #3418 from alphagov/letters-too-long

Mark letters as validation-failed if the templated letter is too long.
This commit is contained in:
Rebecca Law
2022-02-02 08:30:50 +00:00
committed by GitHub
7 changed files with 73 additions and 17 deletions

View File

@@ -116,6 +116,16 @@ def update_billable_units_for_letter(self, notification_id, page_count):
)
@notify_celery.task(
bind=True, name="update-validation-failed-for-templated-letter", max_retries=15, default_retry_delay=300
)
def update_validation_failed_for_templated_letter(self, notification_id, page_count):
notification = get_notification_by_id(notification_id, _raise=True)
notification.status = NOTIFICATION_VALIDATION_FAILED
dao_update_notification(notification)
current_app.logger.info(f"Validation failed: letter is too long {page_count} for letter with id: {notification_id}")
@notify_celery.task(name='collate-letter-pdfs-to-be-sent')
@cronitor("collate-letter-pdfs-to-be-sent")
def collate_letter_pdfs_to_be_sent():