Add hamster tag management, reinstate tags during import, reorganise
code
This commit is contained in:
@ -12,6 +12,7 @@ from peewee import fn, JOIN
|
||||
from textual.logging import TextualHandler
|
||||
|
||||
from .db import (
|
||||
KimaiTag,
|
||||
db,
|
||||
HamsterCategory,
|
||||
HamsterActivity,
|
||||
@ -719,9 +720,12 @@ def _import(search, after, before):
|
||||
description=f.description
|
||||
if f.description != ""
|
||||
else mapping.kimai_description,
|
||||
# tags=f.tags if f.tags != '' else mapping.kimai_tags
|
||||
tags=",".join([t.tag.name for t in f.tags]) if len(f.tags) > 0 else mapping.kimai_tags
|
||||
)
|
||||
r = t.upload().json()
|
||||
if len(f.tags) > 0 or mapping.kimai_tags:
|
||||
print(",".join([t.tag.name for t in f.tags]) if len(f.tags)> 0 else mapping.kimai_tags)
|
||||
print(r["tags"])
|
||||
if r.get("code", 200) != 200:
|
||||
print(r)
|
||||
print(f"{f.id} ({f.activity.category.name} » {f.activity.name})")
|
||||
@ -746,6 +750,7 @@ def init():
|
||||
KimaiCustomer,
|
||||
KimaiProject,
|
||||
KimaiActivity,
|
||||
KimaiTag,
|
||||
HamsterActivityKimaiMapping,
|
||||
HamsterFactKimaiImport,
|
||||
]
|
||||
|
Reference in New Issue
Block a user