Skip to content

Commit

Permalink
formatted tracker reach metrics (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecnmst authored and sammacbeth committed Jul 9, 2018
1 parent 1d9fcda commit 3c5eebe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions whotracksme/website/build/trackers.py
Expand Up @@ -12,9 +12,16 @@


def recent_tracker_reach(reach):
def format_reach(r):
if r >= 0.1:
return round(r, 1)
elif 0.01 <= r <= 0.1:
return round(r, 2)
return "<0.01"

return {
"pages": round(reach['page'][-1]*100, 1),
"sites": round(reach['site'][-1]*100, 1)
"pages": format_reach(reach['page'][-1] * 100),
"sites": format_reach(reach['site'][-1] * 100)
}

def tag_cloud_data(tracker_id, data):
Expand Down

0 comments on commit 3c5eebe

Please sign in to comment.