Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Fix distance rounding for non-metric units
Browse files Browse the repository at this point in the history
Closes #29
  • Loading branch information
otsaloma committed Jun 10, 2018
1 parent a5b41d0 commit 1c80c4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ WhoGo Maps 0.93
* [x] Raise maximum map scale to 2
* [x] Adapt Foursquare provider to API changes
* [x] Prioritise understandable languages in Foursquare tips (#24)
* [x] Fix display of non-metric distances in navigation (#29)
* [x] Fix parsing negative coordinates in search query
4 changes: 2 additions & 2 deletions poor/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,12 @@ def round_distance(meters, n=2):
if meters >= mile:
return siground(meters/mile, n) * mile
n = min(n, math.ceil(math.log10(meters/foot)))
return siground(meters/foot, n) * mile
return siground(meters/foot, n) * foot
elif poor.conf.units == "british":
if meters >= mile:
return siground(meters/mile, n) * mile
n = min(n, math.ceil(math.log10(meters/yard)))
return siground(meters/yard, n) * mile
return siground(meters/yard, n) * yard
else: # Metric
if meters >= 1000:
return siground(meters/1000, n) * 1000
Expand Down

0 comments on commit 1c80c4b

Please sign in to comment.