Skip to content

Commit

Permalink
refactor(tracking): Improve Toggl plugin for GNOME Pomodoro Tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
josehbez committed Sep 23, 2024
1 parent 4e7d861 commit 2438a8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions gnome_pomodoro_tracking/toggl.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,30 +170,28 @@ def add_time_entry(self, **kwargs):
time_entry = {
"start": start, # Required
"description": name,
"projectId": project_id,
"stop": end, # Required
"duration": float(minutes) * 60,
"created_with": "gp-tracking"
"created_with": "gnome-pomodoro-tracking"
}

if workspace_id:
time_entry.update({'wid': workspace_id})
time_entry.update({'workspace_id': int(workspace_id)})

if project_id:
time_entry.update({'pid': project_id})
time_entry.update({'project_id': int(project_id)})

if len(tags):
time_entry.update({'tags': tags})
try:
url = join_url(self.url, "time_entries")
url = join_url(self.url, f"workspaces/{workspace_id}/time_entries")
req = self.rpost(
url, auth=self.http_auth(),
json={"time_entry": time_entry}
json=time_entry
)
if req.ok:
data = req.json()
self.gpt.logger.info(data)
return {'id': data['data']['id'], 'name': name}
return {'id': data['id'], 'name': name}
else:
raise Exception(req.text)
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run(self):

setup(
name="gnome-pomodoro-tracking",
version="4.1.0",
version="4.1.1",
url="https://github.com/gnome-pomodoro/gnome-pomodoro-tracking",
author="Jose Hbez",
author_email="[email protected]",
Expand Down

0 comments on commit 2438a8c

Please sign in to comment.