Merge branch 'master' of github.com:mozilla/FlightDeck

This commit is contained in:
Piotr Zalewa 2011-10-11 17:06:38 +01:00
Родитель b1e6533957 8bd2a0058a
Коммит ff00f24517
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -73,10 +73,11 @@ def _get_average_activity():
return average
# TODO: ES has statistical facet that can provide average, but I couldn't
# get it working.
values = Package.search().values('activity')
qs = Package.search().filter(activity__gt=0)
values = qs.values('activity')[:qs.count()]
num = len(values)
if num > 0:
average = sum(v[1] for v in values) / len(values)
average = sum(v[1] for v in values) / num
else:
average = 0.2