Refactor code

- updated dao_get_letter_jobs_by_status to dao_get_letter_job_ids_by_status to return array of strings
This commit is contained in:
Ken Tsang
2017-08-24 11:57:46 +01:00
parent 451c5a9f1a
commit 1b35731fb2
4 changed files with 23 additions and 31 deletions

View File

@@ -13,7 +13,7 @@ from app.dao.date_util import get_month_start_and_end_date_in_utc
from app.dao.inbound_sms_dao import delete_inbound_sms_created_more_than_a_week_ago
from app.dao.invited_user_dao import delete_invitations_created_more_than_two_days_ago
from app.dao.jobs_dao import (
dao_get_letter_jobs_by_status,
dao_get_letter_job_ids_by_status,
dao_set_scheduled_jobs_to_pending,
dao_get_jobs_older_than_limited_by
)
@@ -308,7 +308,7 @@ def populate_monthly_billing():
@notify_celery.task(name="run-letter-jobs")
@statsd(namespace="tasks")
def run_letter_jobs():
job_ids = [job.id for job in dao_get_letter_jobs_by_status(JOB_STATUS_READY_TO_SEND)]
job_ids = dao_get_letter_job_ids_by_status(JOB_STATUS_READY_TO_SEND)
notify_celery.send_task(
name=TaskNames.DVLA_FILES,
args=(job_ids,),