summaryrefslogtreecommitdiff
path: root/worktime.py
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2020-04-01 08:53:38 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2020-04-01 08:53:38 +0200
commitec0685e13ebd9b6dbfe834774e4cd805ceb2d29c (patch)
tree061050937e2408f97ed16e8588aa3430fb6f4e8f /worktime.py
parent6a596c6527c955348595d61075945b3ca941b1db (diff)
parent69970c39023fb4309db1aa08afeddb59d42dcc05 (diff)
downloadutils-master.tar
utils-master.tar.gz
utils-master.tar.bz2
utils-master.tar.xz
utils-master.zip
Merge branch 'master' of git.ymir:utilsHEADmaster
Diffstat (limited to 'worktime.py')
-rwxr-xr-xworktime.py2
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'])