Use startTime instead of endTime as a time indicator to identify new records

This commit is contained in:
Fabio Manganiello 2019-03-29 10:14:46 +00:00
parent b8e9adadbe
commit 9fc243c93d

View file

@ -73,7 +73,7 @@ class GoogleFitBackend(Backend):
new_data_points = 0
for dp in data_points:
dp_time = dp.pop('endTime', 0)
dp_time = dp.pop('startTime', 0)
if 'dataSourceId' in dp:
del dp['dataSourceId']
@ -81,8 +81,8 @@ class GoogleFitBackend(Backend):
self.bus.post(GoogleFitEvent(
user_id=self.user_id, data_source_id=data_source,
data_type=dp.pop('dataTypeName'),
start_time=dp.pop('startTime'),
end_time=dp_time,
start_time=dp_time,
end_time=dp.pop('endTime'),
modified_time=dp.pop('modifiedTime'),
values=dp.pop('values'),
**{camel_case_to_snake_case(k): v