Skip to content

fix(android_installs): restrict zero filtering to trailing tail only#23

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/parse-report-trailing-zeros-only
Jul 12, 2026
Merged

fix(android_installs): restrict zero filtering to trailing tail only#23
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/parse-report-trailing-zeros-only

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Summary

Fixes the bug identified by the Codex bot in PR #19 review comment discussion_r3566750142.

Problem: parse_report() filtered out any row with value "0", but the intent was to suppress only Play Store's unfinalized trailing days (which report as 0). An internal zero (e.g. 2026-07-06 in the rebuild) is silently dropped, creating a gap in the install series that analyze_stats._load_data() then interpolates over.

Fix: Collect all rows, then strip only the trailing-zero suffix in a second pass. This preserves valid internal zeros while still suppressing Play's unfinalized-tail noise.

# Before: drops ALL zeros
if date and value and value != "0":
    out[date] = value

# After: keep all, trim trailing zeros only
if date and value:
    out[date] = value
dates = sorted(out)
while dates and out[dates[-1]] == "0":
    del out[dates.pop()]

Internal zeros in the install series are valid data (e.g. a mid-series
reporting gap). The previous predicate dropped *any* zero row, which was
only correct for the unfinalized-days case at the tail.

Fix: collect all rows, then strip the trailing-zero suffix in a second
pass. Matches the intent in the original comment and the Codex bot
finding on PR ActivityWatch#19 (discussion_r3566750142).
@ErikBjare ErikBjare merged commit 6961c26 into ActivityWatch:master Jul 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants