Aller au contenu
login
arrow_backRetour aux issues
HafidIdrissi/Time-Tracker #20

Expand longest active-session analytics coverage

ecoDébutant enhancement help wanted good first issue

descriptionDescription

## User problem The dashboard defines a continuous session as active periods separated by no more than 30 seconds, while any idle period ends the session. Only one broad analytics scenario currently covers this calculation. ## Expected result Add focused unit tests that document the exact session boundaries and protect the metric from regressions. ## Likely files - `tests/test_analytics.py` - `timetracker/analytics.py` only if a test reveals a defect ## Acceptance criteria - Cover an empty period list and a single active period. - Verify that a gap of exactly 30 seconds stays in the same session. - Verify that a gap greater than 30 seconds starts a new session. - Verify that an idle period always ends the current session. - Cover overlapping active periods without double-counting elapsed time. - Pass periods in unsorted order and verify deterministic output. - Assert elapsed session time rather than the sum of stored durations. ## Test command ```powershell python -m unittest tests.test_analytics -v python -m unittest discover -v ```
codeOuvre sur GitHub