diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2020-04-01 08:53:38 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2020-04-01 08:53:38 +0200 |
commit | ec0685e13ebd9b6dbfe834774e4cd805ceb2d29c (patch) | |
tree | 061050937e2408f97ed16e8588aa3430fb6f4e8f | |
parent | 6a596c6527c955348595d61075945b3ca941b1db (diff) | |
parent | 69970c39023fb4309db1aa08afeddb59d42dcc05 (diff) | |
download | utils-master.tar utils-master.tar.gz utils-master.tar.bz2 utils-master.tar.xz utils-master.zip |
-rwxr-xr-x | worktime.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/worktime.py b/worktime.py index 639d09c..1cc648a 100755 --- a/worktime.py +++ b/worktime.py | |||
@@ -51,7 +51,7 @@ class TogglAPI(object): | |||
51 | def get_billable_hours(self, start_date, end_date=datetime.now(timezone.utc), rounding=False): | 51 | def get_billable_hours(self, start_date, end_date=datetime.now(timezone.utc), rounding=False): |
52 | url = self._make_url(api = TogglAPISection.REPORTS, section = ['summary'], params={'since': start_date.astimezone(timezone.utc).isoformat(), 'until': end_date.astimezone(timezone.utc).isoformat(), 'rounding': rounding}) | 52 | url = self._make_url(api = TogglAPISection.REPORTS, section = ['summary'], params={'since': start_date.astimezone(timezone.utc).isoformat(), 'until': end_date.astimezone(timezone.utc).isoformat(), 'rounding': rounding}) |
53 | r = self._query(url = url, method='GET') | 53 | r = self._query(url = url, method='GET') |
54 | return timedelta(milliseconds=r.json()['total_billable']) | 54 | return timedelta(milliseconds=r.json()['total_billable']) if r.json()['total_billable'] else timedelta(milliseconds=0) |
55 | 55 | ||
56 | def get_running_clock(self, now=datetime.now(timezone.utc)): | 56 | def get_running_clock(self, now=datetime.now(timezone.utc)): |
57 | url = self._make_url(api = TogglAPISection.TOGGL, section = ['time_entries', 'current']) | 57 | url = self._make_url(api = TogglAPISection.TOGGL, section = ['time_entries', 'current']) |