Add Clockify import, 4matting

This commit is contained in:
3wc
2025-08-07 15:05:07 +01:00
parent 68998be917
commit a3ccc42a6e
3 changed files with 126 additions and 32 deletions

View File

@ -50,15 +50,13 @@ def sync_projects(api, db):
return len(projects)
def export_fact(api, fact, project_id):
def export_fact(api, project_id, start, end, description=None):
"""Export a Hamster fact to Clockify as a time entry"""
start = fact.start_time.isoformat()
end = fact.end_time.isoformat() if fact.end_time else datetime.now().isoformat()
time_entry = api.create_time_entry(
time_entry = api.time_entries.create(
project_id=project_id,
start=start,
end=end,
description=fact.description
description=description,
billable=True
)
return time_entry.id
return time_entry['id']