Skip to content

Commit

Permalink
Correct dict key defense in analytics.html
Browse files Browse the repository at this point in the history
  • Loading branch information
bfalling committed Oct 25, 2016
1 parent cfe115f commit 93ddc9e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions openlibrary/templates/lib/analytics.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
$def with (page)
$ stats = stats_summary()
$if stats['total'] and stats['total']['time']:
$ total_time = float(stats['total']['time']) * 1000
$ raw_time = stats.get('total', {}).get('time') # Assumes that if total present, it's a dict
$if raw_time is not None:
$ total_time = float(raw_time) * 1000
$else:
$ total_time = 0

Expand Down

0 comments on commit 93ddc9e

Please sign in to comment.