Metadata-Version: 2.1
Name: clocking
Version: 0.0.7
Summary: Track the worked time.
Author-email: Matteo Guadrini <matteo.guadrini@hotmail.it>
Maintainer-email: Matteo Guadrini <matteo.guadrini@hotmail.it>
License: GNU General Public License v3.0
Project-URL: homepage, https://github.com/MatteoGuadrini/clocking
Project-URL: documentation, https://clocking.readthedocs.io/en/latest/
Project-URL: repository, https://github.com/MatteoGuadrini/clocking.git
Project-URL: changelog, https://github.com/MatteoGuadrini/clocking/blob/master/CHANGES.md
Keywords: track,worked,time,stamp,mark
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: prettytable

# `clocking`

`clocking` is a command line utility to help you manage your worked hours, vacation, projects or whatever you need to
consider tracking time.

> This project is WIP!

## Testing

[![CircleCI](https://circleci.com/gh/MatteoGuadrini/clocking.svg?style=svg)](https://circleci.com/gh/MatteoGuadrini/clocking)

To test package before use it, follow this:

```commandline
pip install -U pytest
git clone https://github.com/MatteoGuadrini/clocking.git
cd clocking
pytest tests 
```

## Usage

`clocking` was born to be a python library that offers a command line utility.

### As a command line

Use the command line to track and take daily hours worked on projects or not.

```console
$ clocking -h
usage: clocking [-h] [-v] [-V] [-d FILE] {config,cfg,c,set,st,s,delete,del,d,print,prt,p} ...

tracking or monitoring worked hours

positional arguments:
  {config,cfg,c,set,st,s,delete,del,d,print,prt,p}
                        commands to run
    config (cfg, c)     default's configuration
    set (st, s)         setting values
    delete (del, d)     remove values
    print (prt, p)      print values

options:
  -h, --help            show this help message and exit
  -v, --verbose         enable verbosity (default: False)
  -V, --version         print version
  -d FILE, --database FILE
                        select database file (default: None)
```

### Configuration

`clocking` use configurations to apply automatically determine information when insert data into database; these
configurations to creates in command line through `config` section.

```console
# Create configuration
$> clocking config --daily-hours 8 --hour-reward 10 --extraordinary-reward 12 --location "Milan Office" --currency €
# Print configuration
$> clocking config --print
...
# Enable/load configuration
$> clocking config --select-id 1
# Or all in one
$> clocking config --daily-hours 8 --hour-reward 10 --extraordinary-reward 12 --location "Milan Office" --currency € --select-id 1 --print
```

Use `config` action also to delete or clean configurations:

```console
# Delete configuration
$> clocking config --delete-id 1
# Clean all configurations
$> clocking config --reset
```

### As a python module

All useful functions to create scripts or software to track time on projects or days worked, are found in the core
module: `clocking.core`

I create a simple script that tracks hours worked daily.

```python
from sys import argv
from clocking.core import *

mydb = 'mydb.db'
user = 'myuser'

# Create configuration if not was created
if not get_current_configuration(mydb, user):
    # Update version
    update_version(mydb)
    # Create default configuration
    create_configuration_table(mydb)
    add_configuration(mydb,
                      active=True,
                      user=user,
                      location='Italy Office',
                      empty_value='not work!',
                      daily_hours=8.0,
                      working_days="Mon Tue Wed Thu Fri",
                      extraordinary=0.5,
                      permit_hours=1.0,
                      disease='disease',
                      holiday='holiday',
                      currency='€',
                      hour_reward=7.5,
                      extraordinary_reward=8.5,
                      food_ticket=0,
                      other_hours=0,
                      other_reward=8.0
                      )
    enable_configuration(mydb, row_id=1)
    # Prepare table for insert hours
    create_working_hours_table(mydb, user)

# Insert daily hours...
insert_working_hours(mydb, user, argv[1])

# ...and print it!
print_working_table(get_working_hours(mydb, user))
```

## Open source

_clocking_ is an open source project. Any contribute, It's welcome.

**A great thanks**.

For donations, press this

For me

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/guos)

For [Telethon](http://www.telethon.it/)

The Telethon Foundation is a non-profit organization recognized by the Ministry of University and Scientific and
Technological Research.
They were born in 1990 to respond to the appeal of patients suffering from rare diseases.
Come today, we are organized to dare to listen to them and answers, every day of the year.

[Adopt the future](https://www.ioadottoilfuturo.it/)

## Treeware

This package is [Treeware](https://treeware.earth). If you use it in production,
then we ask that you [**buy the world a tree**](https://plant.treeware.earth/matteoguadrini/clocking) to thank us for
our work.
By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

[![Treeware](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=Treeware&query=%24.total&url=https%3A%2F%2Fpublic.offset.earth%2Fusers%2Ftreeware%2Ftrees)](https://treeware.earth)

## Acknowledgments

Thanks to Mark Lutz for writing the _Learning Python_ and _Programming Python_ books that make up my python foundation.

Thanks to Kenneth Reitz and Tanya Schlusser for writing the _The Hitchhiker’s Guide to Python_ books.

Thanks to Dane Hillard for writing the _Practices of the Python Pro_ books.

Special thanks go to my wife, who understood the hours of absence for this development.
Thanks to my children, for the daily inspiration they give me and to make me realize, that life must be simple.

Thanks Python!
