mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-30 11:19:44 -04:00
Sort broadcasts by start time
For emails and text messages we sort by the time the user (or API) sent them. This makes sense for broadcasts too, since most users will receive the alert within seconds of it being broadcast. For alerts that haven’t started yet we can sort by `updated_at`, which is when the user preparing the broadcast submitted it for approval.
This commit is contained in:
@@ -4309,21 +4309,39 @@ def mock_get_broadcast_messages(
|
||||
def _get(service_id):
|
||||
partial_json = partial(
|
||||
broadcast_message_json,
|
||||
id_=fake_uuid,
|
||||
service_id=service_id,
|
||||
template_id=fake_uuid,
|
||||
created_by_id=fake_uuid,
|
||||
)
|
||||
return [
|
||||
partial_json(
|
||||
id_=uuid4(),
|
||||
status='draft',
|
||||
),
|
||||
partial_json(
|
||||
id_=uuid4(),
|
||||
status='pending-approval',
|
||||
updated_at=(
|
||||
datetime.utcnow() - timedelta(minutes=30)
|
||||
).isoformat(),
|
||||
template_name='Half an hour ago',
|
||||
finishes_at=None,
|
||||
),
|
||||
partial_json(
|
||||
id_=uuid4(),
|
||||
status='pending-approval',
|
||||
updated_at=(
|
||||
datetime.utcnow() - timedelta(hours=1, minutes=30)
|
||||
).isoformat(),
|
||||
template_name='Hour and a half ago',
|
||||
finishes_at=None,
|
||||
),
|
||||
partial_json(
|
||||
id_=uuid4(),
|
||||
status='broadcasting',
|
||||
updated_at=(
|
||||
datetime.utcnow()
|
||||
).isoformat(),
|
||||
starts_at=(
|
||||
datetime.utcnow()
|
||||
).isoformat(),
|
||||
@@ -4332,6 +4350,20 @@ def mock_get_broadcast_messages(
|
||||
).isoformat(),
|
||||
),
|
||||
partial_json(
|
||||
id_=uuid4(),
|
||||
status='broadcasting',
|
||||
updated_at=(
|
||||
datetime.utcnow() - timedelta(hours=1)
|
||||
).isoformat(),
|
||||
starts_at=(
|
||||
datetime.utcnow() - timedelta(hours=1)
|
||||
).isoformat(),
|
||||
finishes_at=(
|
||||
datetime.utcnow() + timedelta(hours=24)
|
||||
).isoformat(),
|
||||
),
|
||||
partial_json(
|
||||
id_=uuid4(),
|
||||
status='completed',
|
||||
starts_at=(
|
||||
datetime.utcnow() - timedelta(hours=12)
|
||||
@@ -4341,6 +4373,7 @@ def mock_get_broadcast_messages(
|
||||
).isoformat(),
|
||||
),
|
||||
partial_json(
|
||||
id_=uuid4(),
|
||||
status='cancelled',
|
||||
starts_at=(
|
||||
datetime.utcnow() - timedelta(days=1)
|
||||
|
||||
Reference in New Issue
Block a user