createTimeEntry() should be taking the minute and seconds parameter
sachinsdesai opened this issue · comments
def createTimeEntry(self, hourduration, description=None, projectid=None, projectname=None,
taskid=None, clientname=None, year=None, month=None, day=None, hour=None):
Is there a reason createTimeEntry() has been written without taking the minute and second parameters? Sounds very restrictive to me. If you dont want to change the API, perhaps you can let the hour parameter be a float and extract minute and second values from it
Yeah I agree, it should take hours/minutes/seconds. Open a PR leaving hourduration
as-is to not break the API, and add minutes
and seconds
as kwargs?
Ah gotcha, well all the same, if you want to add those kwargs you're more than welcome to!
All we need is, in TogglPy.py add the code in bold (lines 5 and 6)
year = datetime.now().year if not year else year
month = datetime.now().month if not month else month
day = datetime.now().day if not day else day
hour = datetime.now().hour if not hour else hour
**minute = (hour - int(hour))*60**
timestruct = datetime(year, month, day, int(hour-2), **int(minute)**).isoformat() + '.000Z'
data['time_entry']['start'] = timestruct
data['time_entry']['duration'] = hourduration*3600
data['time_entry']['pid'] = projectid
data['time_entry']['created_with'] = 'NAME'
Sure, open a PR with those changes and I'll merge it in. Thank you!