Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

aarbanas/teamwork-go-scraper

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Teamwork scraper

Simple Go application for calculating hours logged and logging time in Teamwork.

This app can be used without any dependencies. Here is the documentation on how to setup the app. Than just run on UNIX:

$ ./teamwork-go-scraper

For Windows users

$ .\teamwork-go-scraper.exe

For help run:

$ ./teamwork-go-scraper -help

# String flags (must specify value -action=tag)
-action        Action on which hours will be calculated (tag or projectId) (default "tag")
-startDate     Must be in format YYYY-MM-DD (default "first day of current month (e.g. 2024-01-01)")
-endDate       Must be in format YYYY-MM-DD (default "today (e.g. 2024-01-15)")
-t             Start time when to log hours from (HH:mm) (default "09:00")
-value         Value for the specified action. (default "overtime")

# Boolean flags (just passed as arguments)
-c             Use for checking if there are some days where hours are not logged
-h             Use for including Croatian national holidays in the calculations
-l             Enter the logging mode (default: reading logged hours)
-p             If selected hours will be logged by project id (default: log by task id )
-n             Non billable hours in log mode (default: isBillable)
-m             Check time logs for team members

Table of Contents

  1. Prerequisites Go users
  2. Usage
  3. Action
  4. Value
  5. Dates
  6. Logging hours
  7. Logging example
  8. Holidays
  9. Check logged-in hours

For users having Go installed

You must have a running go version locally Go.dev. Run the next command to check if you have a running go version.

$ go version

Just follow the next steps.

  1. Prepare teamwork API key.
  2. Create config.json in the root
  3. Export necessary environment variables (check .config.json-example)
    1. Get the userId from Teamwork

Installation

To install the package just run:

go install github.com/aarbanas/teamwork-go-scraper/cmd@latest

Usage

By default this application is going to calculate all overtime hours logged in teamwork. Here is a list of other options:

Action

Application is accepting two action values: tag(default) and projectId. Based on tag script is going to calculate logged hours. (e.g. if projectId is 12345 than it will return all logged hours for selected project)

go run ./cmd -action=projectId

Value

You can pass any -value which needs to be in the combination with -action. Default value is overtime.

go run ./cmd -action=projectId -value=123456789

Dates

For dates two values can be used:

  1. -startDate - default is first day of the current month (must be in format YYYY-MM-DD)
  2. -endDate - default is today (must be in format YYYY-MM-DD)
go run ./cmd -startDate=2024-01-01 -endDate=2024-01-15

Log mode

In case you want to log new hours, not check for the already logged ones than flag -l needs to be passed.

go run ./cmd -l

Logging hours is selecting startDate and endDate flags, so if they are not passed the default values are used. Using log mode is prompt couple of more questions like taskId, hours/minutes and description.

Log mode by default is logging hours by taskId, but in case hours need to be logged on the project directly there is a flag -p.

go run ./cmd -l -p

Start time

To specify the start time use the flag -t. Time must be provided in format HH:mm

go run ./cmd -l -t=08:30

Example for logging hours January 2024

go run ./cmd -l -p -startDate=2024-01-01 -endDate=2024-01-31

Croatian national holidays

In case you want to log hours and skip Croatian national holidays use -h flag.

go run ./cmd -l -h -startDate=2024-01-01 -endDate=2024-01-31

Check if there are days missing hours

If you want to validate if in the specified period you logged all your hours there is a flag -c made for that purpose. Here you can add Croatian national holidays in the equation.

go run ./cmd -c -h -startDate=2024-01-01 -endDate=2024-01-31

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.