mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Refactored code in tasks.py
This commit is contained in:
@@ -132,10 +132,7 @@ def job_complete(job, service, template_type, resumed=False, start=None):
|
|||||||
if service.research_mode:
|
if service.research_mode:
|
||||||
update_job_to_sent_to_dvla.apply_async([str(job.id)], queue=QueueNames.RESEARCH_MODE)
|
update_job_to_sent_to_dvla.apply_async([str(job.id)], queue=QueueNames.RESEARCH_MODE)
|
||||||
else:
|
else:
|
||||||
build_dvla_file.apply_async(
|
build_dvla_file.apply_async([str(job.id)], queue=QueueNames.JOBS)
|
||||||
[str(job.id)],
|
|
||||||
queue=QueueNames.JOBS
|
|
||||||
)
|
|
||||||
current_app.logger.info("send job {} to build-dvla-file in the {} queue".format(job.id, QueueNames.JOBS))
|
current_app.logger.info("send job {} to build-dvla-file in the {} queue".format(job.id, QueueNames.JOBS))
|
||||||
else:
|
else:
|
||||||
job.job_status = JOB_STATUS_FINISHED
|
job.job_status = JOB_STATUS_FINISHED
|
||||||
@@ -146,7 +143,7 @@ def job_complete(job, service, template_type, resumed=False, start=None):
|
|||||||
|
|
||||||
if resumed:
|
if resumed:
|
||||||
current_app.logger.info(
|
current_app.logger.info(
|
||||||
"Resumed Job {} completed at {}".format(job.id, job.created_at, start, finished)
|
"Resumed Job {} completed at {}".format(job.id, job.created_at)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
current_app.logger.info(
|
current_app.logger.info(
|
||||||
@@ -327,7 +324,7 @@ def save_letter(
|
|||||||
):
|
):
|
||||||
create_letters_pdf.apply_async(
|
create_letters_pdf.apply_async(
|
||||||
[str(saved_notification.id)],
|
[str(saved_notification.id)],
|
||||||
queue=QueueNames.JOBS
|
queue=QueueNames.CREATE_LETTERS_PDF
|
||||||
)
|
)
|
||||||
|
|
||||||
current_app.logger.info("Letter {} created at {}".format(saved_notification.id, saved_notification.created_at))
|
current_app.logger.info("Letter {} created at {}".format(saved_notification.id, saved_notification.created_at))
|
||||||
@@ -631,7 +628,7 @@ def create_letters_pdf(self, notification_id):
|
|||||||
update_notification_status_by_id(notification_id, 'technical-failure')
|
update_notification_status_by_id(notification_id, 'technical-failure')
|
||||||
|
|
||||||
|
|
||||||
def get_letters_pdf(template, contact_block=None, org_id='001', values=None):
|
def get_letters_pdf(template, contact_block, org_id, values=None):
|
||||||
template_for_letter_print = {
|
template_for_letter_print = {
|
||||||
"subject": template.subject,
|
"subject": template.subject,
|
||||||
"content": template.content
|
"content": template.content
|
||||||
|
|||||||
Reference in New Issue
Block a user