Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detailed Reports does not return all data #15

Open
hinoue-work opened this issue Dec 2, 2016 · 4 comments
Open

Detailed Reports does not return all data #15

hinoue-work opened this issue Dec 2, 2016 · 4 comments

Comments

@hinoue-work
Copy link

Currently, it looks like a query using detailed reports in toggl V8 only returns 50 records. You complete the query by doing queries using the 'page' parameter after looking at the total_count returned by the first request.

But in the ruby bindings, the get method in togglv8::Connection ignores everything but the 'data' array, so it's impossible to know if there is more data to be returned. The detailed report in the ruby bindings should automatically iterate over total_count and then return all the data.

@hinoue-work
Copy link
Author

Fixing this seems to have motivated this commit on anwajler's [fork].(anwajler@c09c8d2)

@hinoue-work
Copy link
Author

I've made a modification that fixes this on my own fork. It adds a flag that determines whether to return the body or just the data element. The details method then repeats the query for every page until all rows can be returned.

While this seems to be the minimal change required, you may want a more general solution. Let me know what you would prefer.

@kanet77
Copy link
Owner

kanet77 commented Dec 7, 2016

@hinoue-work, thanks for raising this issue and for the work you've put into it.

If Toggl Reports API requires pagination for detailed reports I think it makes sense for togglv8 to enable users to consume details reports by page. Requesting all pages for every detailed report could cause problems. I started work on this but it requires some refactoring. Do you need this urgently?

I like your idea of giving users the ability retrieve the full response with a function argument. I'll see if I can easily add that. Passing an optional argument all the way down to _call_api is a bit tricky and I'm not sure the best way to do that.

@anwajler's change requires that the /me endpoint is consumed differently. Right now, togglv8 ignores the since field and returns only the contents of data. See examples in the authentication docs:

{
    "since":1361780172,
    "data": {
        "id":123,
        "other...": "fields..."
    }
}

I have a Work-In-Progress branch (which also contains unrelated changes) if it interests you.

@ramhoj
Copy link

ramhoj commented Aug 16, 2021

Here's a quick fork with ErebusBat's URL fix applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants