mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 10:28:55 -04:00
Changed styling
This commit is contained in:
+12
-12
@@ -308,18 +308,18 @@ def update_job_to_sent_to_dvla(self, job_id):
|
|||||||
|
|
||||||
|
|
||||||
def create_dvla_file_contents(job_id):
|
def create_dvla_file_contents(job_id):
|
||||||
file_contents = '\n'.join(
|
file_contents = '\n'.join(
|
||||||
str(LetterDVLATemplate(
|
str(LetterDVLATemplate(
|
||||||
notification.template.__dict__,
|
notification.template.__dict__,
|
||||||
notification.personalisation,
|
notification.personalisation,
|
||||||
# This unique id is a 7 digits requested by DVLA, not known
|
# This unique id is a 7 digits requested by DVLA, not known
|
||||||
# if this number needs to be sequential.
|
# if this number needs to be sequential.
|
||||||
numeric_id=random.randint(1, int('9' * 7)),
|
numeric_id=random.randint(1, int('9' * 7)),
|
||||||
contact_block=notification.service.letter_contact_block,
|
contact_block=notification.service.letter_contact_block,
|
||||||
))
|
))
|
||||||
for notification in dao_get_all_notifications_for_job(job_id)
|
for notification in dao_get_all_notifications_for_job(job_id)
|
||||||
)
|
)
|
||||||
return file_contents
|
return file_contents
|
||||||
|
|
||||||
|
|
||||||
def s3upload(filedata, region, bucket_name, file_location):
|
def s3upload(filedata, region, bucket_name, file_location):
|
||||||
|
|||||||
@@ -444,12 +444,12 @@ def is_delivery_slow_for_provider(
|
|||||||
@statsd(namespace="dao")
|
@statsd(namespace="dao")
|
||||||
@transactional
|
@transactional
|
||||||
def dao_update_notifications_sent_to_dvla(job_id, provider):
|
def dao_update_notifications_sent_to_dvla(job_id, provider):
|
||||||
updated_count = db.session.query(Notification
|
updated_count = db.session.query(
|
||||||
).filter(Notification.job_id == job_id
|
Notification).filter(Notification.job_id == job_id).update(
|
||||||
).update({'status': 'sending', "sent_by": provider})
|
{'status': 'sending', "sent_by": provider})
|
||||||
|
|
||||||
db.session.query(NotificationHistory
|
db.session.query(
|
||||||
).filter(NotificationHistory.job_id == job_id
|
NotificationHistory).filter(NotificationHistory.job_id == job_id).update(
|
||||||
).update({'status': 'sending', "sent_by": provider})
|
{'status': 'sending', "sent_by": provider})
|
||||||
|
|
||||||
return updated_count
|
return updated_count
|
||||||
|
|||||||
+2
-2
@@ -283,8 +283,8 @@ class JobSchema(BaseSchema):
|
|||||||
job_status = field_for(models.JobStatus, 'name', required=False)
|
job_status = field_for(models.JobStatus, 'name', required=False)
|
||||||
|
|
||||||
scheduled_for = fields.DateTime()
|
scheduled_for = fields.DateTime()
|
||||||
service_name = fields.Nested(ServiceSchema, attribute="service", dump_to="service_name", only=["name"],
|
service_name = fields.Nested(
|
||||||
dump_only=True)
|
ServiceSchema, attribute="service", dump_to="service_name", only=["name"], dump_only=True)
|
||||||
|
|
||||||
@validates('scheduled_for')
|
@validates('scheduled_for')
|
||||||
def validate_scheduled_for(self, value):
|
def validate_scheduled_for(self, value):
|
||||||
|
|||||||
@@ -1571,8 +1571,8 @@ def test_dao_update_notifications_sent_to_dvla(notify_db, notify_db_session, sam
|
|||||||
def test_dao_update_notifications_sent_to_dvla_does_update_history_if_test_key(
|
def test_dao_update_notifications_sent_to_dvla_does_update_history_if_test_key(
|
||||||
notify_db, notify_db_session, sample_letter_template, sample_api_key):
|
notify_db, notify_db_session, sample_letter_template, sample_api_key):
|
||||||
job = sample_job(notify_db=notify_db, notify_db_session=notify_db_session, template=sample_letter_template)
|
job = sample_job(notify_db=notify_db, notify_db_session=notify_db_session, template=sample_letter_template)
|
||||||
notification = create_notification(template=sample_letter_template, job=job, api_key_id=sample_api_key.id,
|
notification = create_notification(
|
||||||
key_type='test')
|
template=sample_letter_template, job=job, api_key_id=sample_api_key.id, key_type='test')
|
||||||
|
|
||||||
updated_count = dao_update_notifications_sent_to_dvla(job_id=job.id, provider='some provider')
|
updated_count = dao_update_notifications_sent_to_dvla(job_id=job.id, provider='some provider')
|
||||||
|
|
||||||
|
|||||||
@@ -674,7 +674,7 @@ def test_get_jobs_accepts_page_parameter(
|
|||||||
('', JOB_STATUS_TYPES),
|
('', JOB_STATUS_TYPES),
|
||||||
('pending', [JOB_STATUS_PENDING]),
|
('pending', [JOB_STATUS_PENDING]),
|
||||||
('pending, in progress, finished, sending limits exceeded, scheduled, cancelled, ready to send, sent to dvla',
|
('pending, in progress, finished, sending limits exceeded, scheduled, cancelled, ready to send, sent to dvla',
|
||||||
JOB_STATUS_TYPES),
|
JOB_STATUS_TYPES),
|
||||||
# bad statuses are accepted, just return no data
|
# bad statuses are accepted, just return no data
|
||||||
('foo', [])
|
('foo', [])
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user