From a7a092f30a445800c5886532f13afbcb14132505 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Wed, 16 Jul 2014 14:24:28 -0400 Subject: [PATCH] Count the actual events instead of the records returned from the queryset --- awx/api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/api/views.py b/awx/api/views.py index 19543e4577..05eac5be52 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1741,8 +1741,6 @@ class JobJobTasksList(BaseJobEventsList): .annotate(num=Count('event')) .order_by('parent__id')) - count = queryset.count() - # The data above will come back in a list, but we are going to # want to access it based on the parent id, so map it into a # dictionary. @@ -1775,6 +1773,7 @@ class JobJobTasksList(BaseJobEventsList): if ordering is not None: qs = qs.order_by(ordering) + count = 0 for task_start_event in qs: # Create initial task data. task_data = { @@ -1825,6 +1824,7 @@ class JobJobTasksList(BaseJobEventsList): task_data['failed_count'] += child_data['num'] elif child_data['event'] == 'runner_on_no_hosts': task_data['host_count'] += child_data['num'] + count += 1 results.append(task_data) # Done; return the results and count.