Show jobs on contact list

It’s a bit unintuitive that starting a job from a contact list makes a
copy of the file, which has no relationship to the list it was copied
from. This is more of an implementation detail, rather than something
that comes from people’s mental models of what is going on. Or at least
that’s what I hypothesise.

I think it’s clearer to show jobs that come from contact lists within
the lists that they were created from. By naming the jobs by template
this gives a clearer view of what messages have been sent to the group
over time.
This commit is contained in:
Chris Hill-Scott
2020-05-12 17:31:01 +01:00
parent 149456b73a
commit 423875011c
9 changed files with 257 additions and 61 deletions

View File

@@ -8,7 +8,7 @@ from notifications_utils.timezones import utc_string_to_aware_gmt_datetime
from werkzeug.utils import cached_property
from app.models import JSONModel, ModelList
from app.models.job import PaginatedJobs
from app.models.job import PaginatedJobsAndScheduledJobs
from app.notify_client.contact_list_api_client import contact_list_api_client
from app.s3_client.s3_csv_client import (
get_csv_metadata,
@@ -136,7 +136,7 @@ class ContactList(JSONModel):
return f'{file_name}.csv'
def get_jobs(self, *, page):
return PaginatedJobs(
return PaginatedJobsAndScheduledJobs(
self.service_id,
contact_list_id=self.id,
page=page,

View File

@@ -233,9 +233,19 @@ class ScheduledJobs(ImmediateJobs):
class PaginatedJobs(PaginatedModelList, ImmediateJobs):
client_method = job_api_client.get_page_of_jobs
statuses = None
def __init__(self, service_id, *, contact_list_id=None, page=None):
super().__init__(service_id, contact_list_id=contact_list_id, page=page)
super().__init__(
service_id,
contact_list_id=contact_list_id,
statuses=self.statuses,
page=page,
)
class PaginatedJobsAndScheduledJobs(PaginatedJobs):
statuses = job_api_client.NON_CANCELLED_JOB_STATUSES
class PaginatedUploads(PaginatedModelList, ImmediateJobs):