forked from platypush/platypush
Better handling for last_timestamp reads from Google Fit backend
This commit is contained in:
parent
5880ce51c8
commit
a1c31a9fb9
1 changed files with 4 additions and 5 deletions
|
@ -61,9 +61,9 @@ class GoogleFitBackend(Backend):
|
||||||
get(self._last_timestamp_varname).output.
|
get(self._last_timestamp_varname).output.
|
||||||
get(self._last_timestamp_varname) or 0)
|
get(self._last_timestamp_varname) or 0)
|
||||||
|
|
||||||
for data_source in self.data_sources:
|
|
||||||
new_last_timestamp = last_timestamp
|
new_last_timestamp = last_timestamp
|
||||||
|
|
||||||
|
for data_source in self.data_sources:
|
||||||
for dp in get_plugin('google.fit').get_data(
|
for dp in get_plugin('google.fit').get_data(
|
||||||
user_id=self.user_id, data_source_id=data_source).output:
|
user_id=self.user_id, data_source_id=data_source).output:
|
||||||
dp_time = dp.pop('startTime', 0)
|
dp_time = dp.pop('startTime', 0)
|
||||||
|
@ -82,8 +82,7 @@ class GoogleFitBackend(Backend):
|
||||||
for k,v in dp.items() }
|
for k,v in dp.items() }
|
||||||
))
|
))
|
||||||
|
|
||||||
if dp_time > new_last_timestamp:
|
new_last_timestamp = max(dp_time, new_last_timestamp)
|
||||||
new_last_timestamp = dp_time
|
|
||||||
|
|
||||||
last_timestamp = new_last_timestamp
|
last_timestamp = new_last_timestamp
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue