CLI should not show entry is running when time entry has stop == start
darthwalsh opened this issue · comments
This looks related to #142, but I don't believe the rule "zero is reserved value for running entries" is semantically correct anymore.
I've been using macOS Toggl Desktop to create time entries, and often click the wrong thing, try to remove entries, etc. but toggl-cli is not accurately showing me what toggl's official apps and API are showing.
Actual:
toggl now
shows that no time entry is runningtoggl ls
shows that time entry id 2076769946 is running- REST API shows this entry has start == stop, with duration 0
- toggl python API wrapper says there is no stop, which seems wrong
➜ ~ toggl now
There is no time entry running!
➜ ~ toggl ls -f +id
Description Duration Start Stop Id
failures 0:16:30 10:49:26 AM 11:05:56 AM 07/06/2021 2081866895
163:39:16 4:10:04 PM 07/01/2021 running 2076769946
163:39:45 4:09:35 PM 07/01/2021 running 2076769654
...
➜ ~ curl -u "$($token):api_token" -X GET https://api.track.toggl.com/api/v8/time_entries/2076769946 | jq
{
"data": {
"id": 2076769946,
"guid": "b9a0f6a4922c28df4d300725ca407b3f",
"wid": 5140937,
"billable": false,
"start": "2021-07-01T23:10:04+00:00",
"stop": "2021-07-01T23:10:04+00:00",
"duration": 0,
"duronly": false,
"at": "2021-07-01T23:10:04+00:00",
"uid": 6624544
}
}
➜ ~ py
Python 3.9.6 (default, Jun 29 2021, 05:25:02)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from toggl import api, utils
>>> o = api.TimeEntry.objects.get(2076769946)
>>> o.start
DateTime(2021, 7, 1, 23, 10, 4, tzinfo=Timezone('+00:00'))
>>> o.stop
>>> o.duration
-1625181004
>>> o.to_dict()
{'id': 2076769946, 'workspace': <toggl.api.models.Workspace object at 0x...>, 'description': None, \
'project': None, 'task': None, 'billable': False, \
'start': DateTime(2021, 7, 1, 23, 10, 4, tzinfo=Timezone('+00:00')), \
'stop': None, \
'duration': -1625181004, 'created_with': 'TogglCLI', 'tags': None}
Expected:
I think toggle-cli should show o = api.TimeEntry.objects.get(2076769946)
with o.start == o.stop
and o.duration == 0
, like in the REST response.
Here is how the web app https://track.toggl.com/reports/detailed shows it, with zero-length entries:
Here is how the desktop app shows it (ignore the orange value; that's a different entry):
Hey there,
thanks for the report. This will need a bit more research, but I don't have much time atm, so might take some time before I get to it. Thanks for understanding.
Hey @darthwalsh
Thanks a lot for such a detailed explanation! I have finally understood what you and I guess @joest67 were trying to achieve. Sorry, it took me so long to get to this, but this project is in the lower part of my priorities. I have released a patch fix that should fix this. Hopefully I have not broken some other things with this fix 😅 Lets see if somebody will complain...
@AuHau I installed 2.4.3
and confirmed that toggl ls
shows the correct duration:
Description Duration Start Stop Id
0:00:00 4:10:04 PM 4:10:04 PM 07/01/2021 2076769946
Thanks for making an awesome project! :)