Avoid entries w/ timer still running when exporting to Harvest
i.e. ignore entries on Harvest, which have timer running
This commit is contained in:
parent
e79686b5b7
commit
d8e9714771
|
@ -60,14 +60,19 @@ class TimeEntryImporter(ToHarvest):
|
||||||
Fetch existing time entries from Harvest.
|
Fetch existing time entries from Harvest.
|
||||||
"""
|
"""
|
||||||
cache = {}
|
cache = {}
|
||||||
|
# TODO: we try to avoid entries w/ timer still running here,
|
||||||
|
# but for some reason they still come back, so double-check
|
||||||
entries = self.webapi.get_time_entries(**{'from': self.start_date,
|
entries = self.webapi.get_time_entries(**{'from': self.start_date,
|
||||||
'to': self.end_date})
|
'to': self.end_date,
|
||||||
|
'is_running': False})
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
data = self.normalize_local_object(entry)
|
# double-check here
|
||||||
if data:
|
if not entry['is_running']:
|
||||||
normal = self.normalize_cache_object(entry, data)
|
data = self.normalize_local_object(entry)
|
||||||
key = self.get_cache_key(entry, normal)
|
if data:
|
||||||
cache[key] = normal
|
normal = self.normalize_cache_object(entry, data)
|
||||||
|
key = self.get_cache_key(entry, normal)
|
||||||
|
cache[key] = normal
|
||||||
return cache
|
return cache
|
||||||
|
|
||||||
def normalize_local_object(self, entry):
|
def normalize_local_object(self, entry):
|
||||||
|
|
Loading…
Reference in a new issue