fix: dedupe activities in daily digest instead of summing per run#53
Merged
Conversation
An activity stays in the Strava feed across several scheduler runs, so summing each run's totals counted the same activity once per run it appeared in. RunResult and run-history entries now carry the scanned/would-give/given activity IDs, and build_digest_payload deduplicates by ID (falling back to the old sums for legacy entries). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build_digest_payload) summed each run'stotal/would_give/givencounts, but the same activity typically stays in the Strava feed across several scheduler runs β so it was counted once per run instead of once overall.RunResultand run-history entries now carry the activity IDs seen per run (activity_ids,would_give_ids,given_ids); the digest deduplicates by ID via a set, with a per-entry fallback to the old raw counts for history entries written before this change.Test plan
ruff check/ruff format --check/mypy srcβ all cleanpytestβ 497 passed, 88% coverage