Skip to content

Feat: download Toggl detailed time reports as CSV #26

New issue

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

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

Already on GitHub? # to your account

Merged
merged 10 commits into from
Sep 26, 2024

Conversation

thekaveman
Copy link
Member

@thekaveman thekaveman commented Sep 25, 2024

Part of #25

New command

$ compiler-admin time download -h
usage: compiler-admin time download [-h] [--start YYYY-MM-DD] [--end YYYY-MM-DD] [--output OUTPUT]
                                    [--client CLIENT_ID] [--project PROJECT_ID] [--task TASK_ID] [--user USER_ID]

options:
  -h, --help            show this help message and exit
  --start YYYY-MM-DD    The start date of the reporting period. Defaults to the beginning of the prior month.
  --end YYYY-MM-DD      The end date of the reporting period. Defaults to the end of the prior month.
  --output OUTPUT       The path to the file where converted data should be written. Defaults to stdout.
  --client CLIENT_ID    An ID for a Toggl Client to filter for in reports. Can be supplied more than once.
  --project PROJECT_ID  An ID for a Toggl Project to filter for in reports. Can be supplied more than once.
  --task TASK_ID        An ID for a Toggl Project Task to filter for in reports. Can be supplied more than once.
  --user USER_ID        An ID for a Toggl User to filter for in reports. Can be supplied more than once.

Example usage

All defaults

compiler-admin time download

Custom date range

compiler-admin time download --start 2024-09-01 --end 2024-09-30

Custom output file

compiler-admin time download --output /path/to/file.csv

Filter projects

compiler-admin time download --project 1234 --project 5678

Filter users

compiler-admin time download --user 1234 --user 5678

Required .env

An API token and Workspace ID for Toggl are required

TOGGL_API_TOKEN=token
TOGGL_WORKSPACE_ID=workspace

Optional .env

Default filter for a Toggl Client

TOGGL_CLIENT_ID=client

Copy link

github-actions bot commented Sep 25, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  compiler_admin
  main.py
  compiler_admin/commands/time
  __init__.py
  download.py
  compiler_admin/services
  toggl.py 90
Project Total  

This report was generated by python-coverage-comment-action

@thekaveman thekaveman force-pushed the feat/toggl-reports branch 4 times, most recently from e1bb152 to dbc0b2b Compare September 25, 2024 21:40
@thekaveman thekaveman self-assigned this Sep 25, 2024
compiler-admin time download --start YYYY-MM-DD --end YYYY-MM-DD --output path/to/file.csv

small fix on convert test assertion
@thekaveman thekaveman marked this pull request as ready for review September 26, 2024 01:13
@thekaveman thekaveman merged commit 7272291 into main Sep 26, 2024
1 check passed
@thekaveman thekaveman deleted the feat/toggl-reports branch September 26, 2024 01:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant