diff --git a/healthgraph/parser.py b/healthgraph/parser.py
index 18e7892..540823a 100644
--- a/healthgraph/parser.py
+++ b/healthgraph/parser.py
@@ -64,7 +64,7 @@ def parse_distance(val):
if val is None:
return None
try:
- return float(val) / 1000
+ return float(val)
except:
raise exceptions.ParseValueError("Error parsing distance value.")
@@ -72,7 +72,7 @@ def parse_distance_km(val):
if val is None:
return None
try:
- return float(val)
+ return float(val) * 1000
except:
raise exceptions.ParseValueError("Error parsing distance value.")
diff --git a/samples/bottle/views/welcome.html b/samples/bottle/views/welcome.html
index 80167fd..943928a 100644
--- a/samples/bottle/views/welcome.html
+++ b/samples/bottle/views/welcome.html
@@ -37,7 +37,7 @@
Recent Activities
{{ stats.get('start_time') }} |
{{ stats.get('type') }} |
- {{ '%.1f' % stats.get('total_distance', 0) }} |
+ {{ '%.1f' % (stats.get('total_distance', 0.0) / 1000) }} |
%end
@@ -58,11 +58,11 @@ Total Distance
%for sport, stats in records.items():
{{ sport }} |
- {{ '%.1f' % stats.get('THIS_WEEK', 0) }} |
- {{ '%.1f' % stats.get('LAST_WEEK', 0) }} |
- {{ '%.1f' % stats.get('THIS_MONTH', 0) }} |
- {{ '%.1f' % stats.get('LAST_MONTH', 0) }} |
- {{ '%.1f' % stats.get('OVERALL', 0) }} |
+ {{ '%.1f' % (stats.get('THIS_WEEK', 0.0) / 1000) }} |
+ {{ '%.1f' % (stats.get('LAST_WEEK', 0.0) / 1000) }} |
+ {{ '%.1f' % (stats.get('THIS_MONTH', 0.0) / 1000) }} |
+ {{ '%.1f' % (stats.get('LAST_MONTH', 0.0) / 1000) }} |
+ {{ '%.1f' % (stats.get('OVERALL', 0.0) / 1000) }} |
%end