mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -05:00
fix platform admin stats row-order bug
now that we're reading from two tables (ft_notification_status and notifications) for stats, we'll get a couple of rows for each notification type. If a service doesn't have any rows in one of those tables, the query will return a row with nulls for the notification types and counts. Some services will have history but no stats from today, others will have data from today but no history. This commit acknowledges that any row might have nulls, not just the first row.
This commit is contained in:
@@ -478,10 +478,7 @@ def get_detailed_services(start_date, end_date, only_active=False, include_from_
|
||||
results = []
|
||||
for service_id, rows in itertools.groupby(stats, lambda x: x.service_id):
|
||||
rows = list(rows)
|
||||
if rows[0].count is None:
|
||||
s = statistics.create_zeroed_stats_dicts()
|
||||
else:
|
||||
s = statistics.format_statistics(rows)
|
||||
s = statistics.format_statistics(rows)
|
||||
results.append({
|
||||
'id': str(rows[0].service_id),
|
||||
'name': rows[0].name,
|
||||
|
||||
Reference in New Issue
Block a user