Skip to content

Commit

Permalink
Merge pull request #23 from niknow/re-fix-distance
Browse files Browse the repository at this point in the history
fixes #22'
  • Loading branch information
slawek87 committed Aug 27, 2015
2 parents ab2760e + bc68ace commit dc6269a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions geolocation/distance_matrix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def distance(self, value):
model = Distance()

if value:
pattern = r'(?P<value>[\d,]+)\s(?P<unit>km|m)$'
pattern = r'(?P<value>[\d,.]+)\s(?P<unit>km|m)$'

unit = re.match(pattern, value).group('unit')
value = re.match(pattern, value).group('value').replace(',', '').replace('.', ',')
value = re.match(pattern, value).group('value').replace(',', '')

if unit == const.UNIT_KM:
model.kilometers = float(value)
Expand Down

0 comments on commit dc6269a

Please sign in to comment.