Fix big numbers on new platform admin page

Turns out the counts were all showing as zero because the generator had
already been consumed by the time we were trying to do the stats. Making
it a list comprehension means it can’t get exhausted.
This commit is contained in:
Chris Hill-Scott
2017-07-31 11:29:04 +01:00
parent ec6e028a9a
commit 1e1dd49312
2 changed files with 67 additions and 3 deletions

View File

@@ -76,7 +76,7 @@ def sum_service_usage(service):
def filter_and_sort_services(services, trial_mode_services=False):
return (
return [
service for service in sorted(
services,
key=lambda service: (
@@ -87,7 +87,7 @@ def filter_and_sort_services(services, trial_mode_services=False):
reverse=True,
)
if service['restricted'] == trial_mode_services
)
]
def create_global_stats(services):