aw-client-js icon indicating copy to clipboard operation
aw-client-js copied to clipboard

AWClient.countEvents() is querying using incorrect params

Open Francoisvt04 opened this issue 2 years ago • 0 comments

Issue

Just recently used your library for interacting with the Activity Watch client via JS I did notice that when I query the event count it does not correlate with the results I get back from fetching the events.

Context

For both queries I used the same start and end time but the count and results do not line up. I used a limit of 100 and one of my buckets came back with a count of 389 but the records returned where only 97. So I checked the request and your source code noticed that for AWClient.countEvents() you are passing the time params as "starttime" and "endtime" which are not the params stated in the docs, resulting in from what I can see it querying all the data in a bucket instead of scoping to the timestamps.

TLDR Fix

Query params for AWClient.countEvents() should be start and end, not starttime, endtime when making the request.

Francoisvt04 avatar Jan 19 '23 12:01 Francoisvt04