Skip to content
Snippets Groups Projects
Verified Commit 5c4389cd authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add some totals and basic numbers to stats.

parent c4f404e1
No related branches found
No related tags found
No related merge requests found
from statistics import harmonic_mean
from . import stats_plugin
def _field_count(db, geocacher, field):
......@@ -35,3 +37,25 @@ def difficulty_terrain_count(db, geocacher):
res[combo] += 1
return res
@stats_plugin
def totals(db, geocacher):
res = {}
res['found'] = len(geocacher.found_geocaches)
res['types'] = len(type_count(db, geocacher).keys())
res['sizes'] = len(size_count(db, geocacher).keys())
return res
@stats_plugin
def min_max_avg(db, geocacher):
res = {}
data = [cache.difficulty for cache in geocacher.found_geocaches]
res['difficulty'] = (min(data), max(data), harmonic_mean(data))
data = [cache.terrain for cache in geocacher.found_geocaches]
res['terrain'] = (min(data), max(data), harmonic_mean(data))
return res
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment