From 4c8dd9de4d6a8e8d6e2652ae98deda44add091fb Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Mon, 29 Nov 2021 15:24:51 +0200 Subject: [PATCH] update readme and add tags --- README.md | 5 ++++- hamstertools/__init__.py | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index df7012d..3174cb6 100644 --- a/README.md +++ b/README.md @@ -52,4 +52,7 @@ hamster](https://github.com/projecthamster/hamster-lib) is ready. 1. Run `hamster-tool activities list --csv` to get a dump of all activities 2. Review the export to check for any duplicates, typoes, etc. 3. Use e.g. `hamster-tool activities move-facts ...` to clean them up -4. +4. Run `python -m hamstertools kimai import --mapping-path mapping.kimai.csv --show-missing --after 2021-09-07 --category-search auto 3wordchant` to find entries in your time tracking which don't yet have a mapping to Kimai. You might notice some extra tidying needed here. +5. Run `python -m hamstertools kimai sync --mapping-path mapping.kimai.csv --just-errors --ignore-activities 3wordchant $(pass users/calix/logins/kimai.autonomic.zone/api)` to find items in your mapping file which don't exist on Kimai +5. Run `python -m hamstertools kimai import --mapping-path mapping.kimai.csv --after 2021-09-07 --category-search auto 3wordchant -o kimai_$(date +%F).csv` to generate a CSV of your time entries +6. Review your timesheet -- NB it might not be sorted in date order by default - to make sure it has the expected entries, and remove any entries already in Kimai. diff --git a/hamstertools/__init__.py b/hamstertools/__init__.py index a87d525..17c2f1b 100755 --- a/hamstertools/__init__.py +++ b/hamstertools/__init__.py @@ -496,6 +496,7 @@ def sync(username, api_key, just_errors, ignore_activities, mapping_path=None): just_errors or click.secho("Found activity '{0}'".format(activity_str), fg='green') found_activities.append(activity_str) + @kimai.command('import') @click.option('--mapping-path', help='Mapping file (default ~/.local/share/hamster/mapping.kimai.csv)') @click.option('--output', help='Output file (default kimai.csv)') @@ -521,7 +522,7 @@ def _import(username, mapping_path=None, output=None, category_search=None, afte next(mapping_reader) mapping = { - '{0}:{1}'.format(row[0], row[1]): [row[2], row[3], row[4]] + '{0}:{1}'.format(row[0], row[1]): [row[2], row[3], row[4], row[5]] for row in mapping_reader } @@ -618,7 +619,7 @@ def _import(username, mapping_path=None, output=None, category_search=None, afte mapping_[2], fact[3] or '', '0', # Exported - '', # Tags + mapping_[3], '', # Hourly rate '', # Fixed rate ])