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

Incomplete Project Listing and Issues Adding Time Entries When There Are More Than 151 Projects #330

Open
litiaikin opened this issue Jul 27, 2024 · 0 comments

Comments

@litiaikin
Copy link

Hello, thanks for the cool app!

Incomplete Listing of Projects

I have about 200 projects in my Toggl workspace, most of which are archived, with only 22 currently active. When I run toggl projects ls, I only see 151 of them, and some of the active ones are missing. This is probably because Toggl returns a maximum of 151 projects if the per_page query parameter is not specified.

Issues Adding a Time Entry

Another issue I've encountered, which might be related to the first one, is that when I'm adding a time entry for an active project missing from the toggl projects ls listing, using the project name results in an error:

toggl add 09AM 1m 'test description' --project=PROJECT1 --billable                                                       
Usage: toggl add [OPTIONS] START STOP DESCR
Try 'toggl add --help' for help.

Error: Invalid value for '--project' / '-o': Unknown Project under specification 'PROJECT1'!

However, when I use the project ID instead of the project name, the command works fine.

My temporary fix

Since I only work with active projects, I was able to fix both issues by adding the ?active=true filter to the WorkspaceTogglSet.build_list_url method in a toggl/api/base.py:

   def build_list_url(self, caller, config, conditions):  # type: (str, utils.Config, typing.Dict) -> str
        wid = self._get_workspace_id(config, conditions)
        url = f'/workspaces/{wid}/{self.entity_endpoints_name}'
        if (self.entity_endpoints_name == 'projects'):
            url += '?active=true'

Perhaps someone could come up with a more general solution that allows retrieving a full list of both archived and active projects.

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

1 participant