diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2020-04-01 08:49:57 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2020-04-01 08:49:57 +0200 |
commit | 69970c39023fb4309db1aa08afeddb59d42dcc05 (patch) | |
tree | 6b78d64b5a53dcf12a84f0af0c27d49105abfc3c | |
parent | 3876466c5c5a107e345da3bca42f5277e6e07046 (diff) | |
download | utils-69970c39023fb4309db1aa08afeddb59d42dcc05.tar utils-69970c39023fb4309db1aa08afeddb59d42dcc05.tar.gz utils-69970c39023fb4309db1aa08afeddb59d42dcc05.tar.bz2 utils-69970c39023fb4309db1aa08afeddb59d42dcc05.tar.xz utils-69970c39023fb4309db1aa08afeddb59d42dcc05.zip |
fix worktime
-rwxr-xr-x | worktime.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/worktime.py b/worktime.py index 19e2186..3f577ea 100755 --- a/worktime.py +++ b/worktime.py | |||
@@ -46,7 +46,7 @@ class TogglAPI(object): | |||
46 | def get_billable_hours(self, start_date, end_date=datetime.now(timezone.utc)): | 46 | def get_billable_hours(self, start_date, end_date=datetime.now(timezone.utc)): |
47 | url = self._make_url(api = TogglAPISection.REPORTS, section = ['summary'], params={'since': start_date.astimezone(timezone.utc).isoformat(), 'until': end_date.astimezone(timezone.utc).isoformat()}) | 47 | url = self._make_url(api = TogglAPISection.REPORTS, section = ['summary'], params={'since': start_date.astimezone(timezone.utc).isoformat(), 'until': end_date.astimezone(timezone.utc).isoformat()}) |
48 | r = self._query(url = url, method='GET') | 48 | r = self._query(url = url, method='GET') |
49 | return timedelta(milliseconds=r.json()['total_billable']) | 49 | return timedelta(milliseconds=r.json()['total_billable']) if r.json()['total_billable'] else timedelta(milliseconds=0) |
50 | 50 | ||
51 | def get_running_clock(self, now=datetime.now(timezone.utc)): | 51 | def get_running_clock(self, now=datetime.now(timezone.utc)): |
52 | url = self._make_url(api = TogglAPISection.TOGGL, section = ['time_entries', 'current']) | 52 | url = self._make_url(api = TogglAPISection.TOGGL, section = ['time_entries', 'current']) |