From 0a554aae142453334131142954c62e2ada4dd6ac Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Sun, 1 Feb 2026 21:56:20 +0100 Subject: [PATCH] feat: implement basic timesheet command Signed-off-by: Konstantin Fickel --- src/streamer/__init__.py | 16 ++++++++++++++++ src/streamer/timesheet/configuration.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/streamer/__init__.py b/src/streamer/__init__.py index dbb9151..6109ca8 100644 --- a/src/streamer/__init__.py +++ b/src/streamer/__init__.py @@ -18,7 +18,10 @@ from streamer.localize import ( from streamer.localize.preconfigured_configurations import TaskConfiguration from streamer.parse import parse_markdown_file from streamer.query import find_shard_by_position +from streamer.query.find import find_shard_by_set_dimension from streamer.settings import Settings +from streamer.timesheet.configuration import BasicTimesheetConfiguration +from streamer.timesheet.extract import extract_timesheets app = typer.Typer() @@ -71,6 +74,19 @@ def edit(number: Annotated[int, typer.Argument()] = 1) -> None: click.edit(None, filename=sorted_shards[selected_number].location["file"]) +@app.command() +def timesheet() -> None: + all_shards = list(all_files(BasicTimesheetConfiguration)) + sheets = sorted(extract_timesheets(all_shards), key=lambda card: card.date) + for sheet in sheets: + print(sheet.date) + print( + ",".join( + map(lambda card: f"{card.from_time},{card.to_time}", sheet.timecards) + ), + ) + + @app.command() def new() -> None: streamer_directory = Settings().base_folder diff --git a/src/streamer/timesheet/configuration.py b/src/streamer/timesheet/configuration.py index 418d37a..6b6c55d 100644 --- a/src/streamer/timesheet/configuration.py +++ b/src/streamer/timesheet/configuration.py @@ -34,7 +34,7 @@ BasicTimesheetConfiguration = RepositoryConfiguration( placements=[ MarkerPlacement( dimension=TIMESHEET_DIMENSION_NAME, - value=TimesheetPointType.Vacation.value, + value=TimesheetPointType.Card.value, overwrites=False, ) ],