Sort entries, fix docs

This commit is contained in:
3wc 2023-01-12 16:34:51 -08:00
parent d171cf4c5d
commit 40c0312e4c
2 changed files with 11 additions and 4 deletions

View File

@ -50,9 +50,9 @@ hamster](https://github.com/projecthamster/hamster-lib) is ready.
## Importing into Kimai
1. Run `hamster-tool activities list --csv` to get a dump of all activities
1. Run `python -m hamstertools 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
3. Use e.g. `python -m hamstertools activities move-facts ...` to clean them up
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 --output kimai_$(date +%F).csv` to generate a CSV of your time entries

View File

@ -206,6 +206,8 @@ def list_activities(search, csv_output):
results = get_activities(search=search)
results.sort(key=lambda t: (t[2], t[1]))
if csv_output:
csv_writer = csv.writer(sys.stdout)
@ -412,7 +414,9 @@ def _get_kimai_mapping_file(path):
'FROM activity',
'TO Customer',
'TO Project',
'TO Activity'
'TO Activity',
'TO Tag',
'TO Note'
])
results = get_activities(category_search=category_search)
@ -644,6 +648,9 @@ def _import(username, mapping_path=None, output=None, category_search=None, afte
), fg='yellow')
continue
if len(mapping_) < 5:
mapping_.append(None)
date_start, date_end = (
datetime.strptime(fact[2].split('.')[0], '%Y-%m-%d %H:%M:%S'),
datetime.strptime(fact[1].split('.')[0], '%Y-%m-%d %H:%M:%S')
@ -662,7 +669,7 @@ def _import(username, mapping_path=None, output=None, category_search=None, afte
mapping_[0],
mapping_[1],
mapping_[2],
fact[3] or '',
fact[3] or mapping_[4] or '',
'0', # Exported
mapping_[3],
'', # Hourly rate