fix: sliding period window for datetime precision
Some checks failed
checks / checks (3.10) (push) Has been cancelled
checks / checks (3.11) (push) Has been cancelled
checks / checks (3.12) (push) Has been cancelled
checks / checks (3.13) (push) Has been cancelled

After --commit with precision=datetime, last_used held from==to==now,
so the next default period degenerated to a single second and showed
no new time entries. Now --commit stores the real report window start
and get_default_date_range() returns last_used.to..now for
datetime+dynamic mode.

Closes #70
This commit is contained in:
Кокос Артем Николаевич
2026-09-15 15:40:20 +07:00
parent 35fa585bd0
commit 4a9a21624d
4 changed files with 116 additions and 25 deletions

View File

@@ -580,10 +580,9 @@ def main(argv: Optional[List[str]] = None) -> int:
dynamic = Config._app.period_dynamic if Config._app else False
if precision == "datetime":
# Сохраняем aware UTC (#58): следующий запуск вычисляет из этой
# метки aware cutoff для дедупликации.
now = datetime.now(timezone.utc).isoformat(timespec="seconds")
from_str = now
# from -- фактическое начало окна отчёта; to -- дедуп-маркер (naive UTC).
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S")
from_str = from_date
to_str = now
else:
from_str = from_date