Skip to content

Commit

Permalink
fix #10
Browse files Browse the repository at this point in the history
  • Loading branch information
sirfoga committed Feb 8, 2019
1 parent 68c7b87 commit fc3991a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pygce/models/garmin/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ def __init__(self, date_time, raw_html):
self.content = json.loads(self.html)
self.bins = []

@staticmethod
def parse_steps_count(raw):
raw = str(raw)
if raw.endswith('.0'): # remove decimal point
raw = raw[:-2]

raw = raw.replace('.', '') # remove thousands point

return int(raw)

def parse(self):
for data in self.content:
date_time = data['startGMT'][:-2] # remove trailing 0
Expand All @@ -242,7 +252,7 @@ def parse(self):

self.bins.append({
'time': date_time,
'steps': steps_count
'steps': self.parse_steps_count(steps_count)
})

def to_dict(self):
Expand Down

0 comments on commit fc3991a

Please sign in to comment.