Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
librestash
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nik | Klampfradler
librestash
Commits
5c4389cd
Verified
Commit
5c4389cd
authored
7 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Add some totals and basic numbers to stats.
parent
c4f404e1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
librestash/lib/stats/basic.py
+24
-0
24 additions, 0 deletions
librestash/lib/stats/basic.py
with
24 additions
and
0 deletions
librestash/lib/stats/basic.py
+
24
−
0
View file @
5c4389cd
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment