Fix (more) start/end date defaults for importers, per upstream changes

This commit is contained in:
Lance Edgar 2023-09-25 13:26:58 -05:00
parent 2f21e574ae
commit e58d843ee4
3 changed files with 22 additions and 9 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -60,11 +60,15 @@ class TimeEntryImporter(ToHarvest):
Fetch existing time entries from Harvest.
"""
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,
'to': self.end_date,
'is_running': False})
kw = {'is_running': False}
if self.start_date:
kw['from'] = self.start_date
if self.end_date:
kw['to'] = self.end_date
entries = self.webapi.get_time_entries(**kw)
for entry in entries:
# double-check here
if not entry['is_running']: