Skip to content

Commit

Permalink
Update to use metre instead of km as distance unit.
Browse files Browse the repository at this point in the history
  • Loading branch information
aouyar committed Feb 26, 2013
1 parent 9050b69 commit 9abab4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions healthgraph/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ 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.")

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.")

Expand Down
12 changes: 6 additions & 6 deletions samples/bottle/views/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h2>Recent Activities</h2>
<tr>
<td>{{ stats.get('start_time') }}</td>
<td>{{ stats.get('type') }}</td>
<td align="right">{{ '%.1f' % stats.get('total_distance', 0) }}</td>
<td align="right">{{ '%.1f' % (stats.get('total_distance', 0.0) / 1000) }}</td>
</tr>
%end
</tbody>
Expand All @@ -58,11 +58,11 @@ <h2>Total Distance</h2>
%for sport, stats in records.items():
<tr>
<td>{{ sport }}</td>
<td align="right">{{ '%.1f' % stats.get('THIS_WEEK', 0) }}</td>
<td align="right">{{ '%.1f' % stats.get('LAST_WEEK', 0) }}</td>
<td align="right">{{ '%.1f' % stats.get('THIS_MONTH', 0) }}</td>
<td align="right">{{ '%.1f' % stats.get('LAST_MONTH', 0) }}</td>
<td align="right">{{ '%.1f' % stats.get('OVERALL', 0) }}</td>
<td align="right">{{ '%.1f' % (stats.get('THIS_WEEK', 0.0) / 1000) }}</td>
<td align="right">{{ '%.1f' % (stats.get('LAST_WEEK', 0.0) / 1000) }}</td>
<td align="right">{{ '%.1f' % (stats.get('THIS_MONTH', 0.0) / 1000) }}</td>
<td align="right">{{ '%.1f' % (stats.get('LAST_MONTH', 0.0) / 1000) }}</td>
<td align="right">{{ '%.1f' % (stats.get('OVERALL', 0.0) / 1000) }}</td>
</tr>
%end
</tbody>
Expand Down

0 comments on commit 9abab4c

Please sign in to comment.