Skip to content

fix(weight): dedup identical same-day readings on ingest#39

Merged
rwlove merged 1 commit into
mainfrom
fix/weight-ingest-dedup
Jun 10, 2026
Merged

fix(weight): dedup identical same-day readings on ingest#39
rwlove merged 1 commit into
mainfrom
fix/weight-ingest-dedup

Conversation

@rwlove

@rwlove rwlove commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Root-cause follow-up to #38. The bt-scale gateway burst-posts the same reading several times as it settles, and InsertW appended every one — the source of the duplicate weight rows. InsertW now skips inserting when a row already exists for the same date and weight, while still allowing a genuinely different value the same day (latest recorded_at wins for display). NUMERIC comparison treats 272.2 and 272.20 as equal. Verified on a live-data preview (same reading 3x → 1 row; different value same day → 2; formatting variant dedups). No schema change.

🤖 Generated with Claude Code

The bt-scale gateway burst-posts the same reading several times as it settles
(e.g. six identical 272.20 rows for 2026-06-07 within 4 seconds), and InsertW
appended every one — the source of the duplicate rows that DeleteW now has to
mop up by date.

InsertW now skips the insert when a row already exists for the same date and
weight, while still allowing a genuinely different value on the same day (the
log shows the latest recorded_at, so multiple distinct weigh-ins per day remain
supported). NUMERIC comparison makes "272.2" and "272.20" equal.

Verified against a live-data preview: posting the same (date, weight) three
times yields one row; a different value the same day yields two; a re-posted
formatting variant dedups. No schema change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rwlove rwlove merged commit 8ad0f61 into main Jun 10, 2026
4 checks passed
@rwlove rwlove deleted the fix/weight-ingest-dedup branch June 10, 2026 16:24
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.

1 participant