mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Refactor to use constants for scheduled status
Reduces risk of typos, matches what we do for other statuses.
This commit is contained in:
@@ -14,8 +14,9 @@ class JobApiClient(NotifyAdminAPIClient):
|
|||||||
'ready to send',
|
'ready to send',
|
||||||
'sent to dvla'
|
'sent to dvla'
|
||||||
}
|
}
|
||||||
|
SCHEDULED_JOB_STATUS = 'scheduled'
|
||||||
NON_SCHEDULED_JOB_STATUSES = JOB_STATUSES - {'scheduled', 'cancelled'}
|
CANCELLED_JOB_STATUS = 'cancelled'
|
||||||
|
NON_SCHEDULED_JOB_STATUSES = JOB_STATUSES - {SCHEDULED_JOB_STATUS, CANCELLED_JOB_STATUS}
|
||||||
|
|
||||||
def get_job(self, service_id, job_id):
|
def get_job(self, service_id, job_id):
|
||||||
params = {}
|
params = {}
|
||||||
@@ -65,7 +66,10 @@ class JobApiClient(NotifyAdminAPIClient):
|
|||||||
|
|
||||||
def get_scheduled_jobs(self, service_id):
|
def get_scheduled_jobs(self, service_id):
|
||||||
return sorted(
|
return sorted(
|
||||||
self.get_jobs(service_id, statuses=['scheduled'])['data'],
|
self.get_jobs(
|
||||||
|
service_id,
|
||||||
|
statuses=[self.SCHEDULED_JOB_STATUS]
|
||||||
|
)['data'],
|
||||||
key=lambda job: job['scheduled_for']
|
key=lambda job: job['scheduled_for']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user