mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-26 22:27:20 +01:00
Tag manual workouts with source manual
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
dc2799e36a
commit
e7ef648757
@ -2,7 +2,7 @@ name: diet_guard_app
|
|||||||
description: "Companion phone app for diet_guard: log meals on the go."
|
description: "Companion phone app for diet_guard: log meals on the go."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.0.148+1
|
version: 1.0.149+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.12.2
|
sdk: ^3.12.2
|
||||||
|
|||||||
@ -100,11 +100,16 @@ def _clock_window(day: str, item: dict[str, object]) -> tuple[str | None, str |
|
|||||||
def manual_session(
|
def manual_session(
|
||||||
day: str, item: dict[str, object], minutes: float, label: str
|
day: str, item: dict[str, object], minutes: float, label: str
|
||||||
) -> Session:
|
) -> Session:
|
||||||
"""The :class:`Session` one manual workout stands for."""
|
"""The :class:`Session` one manual workout stands for.
|
||||||
|
|
||||||
|
Source is "manual" so the phone's activity sheet can paint the human-typed
|
||||||
|
label (``source == "manual"`` in Dart). Verified screen-locker workouts keep
|
||||||
|
source "screen-locker".
|
||||||
|
"""
|
||||||
text = _text(item)
|
text = _text(item)
|
||||||
kind = _kind(item, text)
|
kind = _kind(item, text)
|
||||||
km = _typed_km(item)
|
km = _typed_km(item)
|
||||||
if km is None and kind in {"run", "walk"}:
|
if km is None and kind in {"run", "walk"}:
|
||||||
km = _text_km(text)
|
km = _text_km(text)
|
||||||
start, end = _clock_window(day, item)
|
start, end = _clock_window(day, item)
|
||||||
return Session(day, kind, minutes, km, label, "screen-locker", start, end)
|
return Session(day, kind, minutes, km, label, "manual", start, end)
|
||||||
|
|||||||
@ -47,3 +47,7 @@ class TestManualParse:
|
|||||||
assert start is not None
|
assert start is not None
|
||||||
assert end is not None
|
assert end is not None
|
||||||
assert logged_window("never", 60) == (None, None)
|
assert logged_window("never", 60) == (None, None)
|
||||||
|
|
||||||
|
def test_manual_session_source_is_manual(self) -> None:
|
||||||
|
session = manual_session("2026-09-20", {}, 45.0, "walk to work")
|
||||||
|
assert session.source == "manual"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user