mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
docs(workout): TODO for cross-source workout dedup at v1.5 iOS landing
The Workout uniqueness key is (userId, source, externalId). The same workout ingested from MANUAL plus the iOS HealthKit passthrough lands two rows because `source` differs — Postgres NULL-distinct semantics keep manual workouts unique among themselves, but the cross-source case has no canonical-picker layer yet. Measurements already solved the symmetric problem via the W8c canonical-source picker. Workouts need the same shape before the dashboard "recent workouts" tile can show one row per workout instead of one per source. Schema-only release today (W8d), and there is no iOS client yet, so the smell is latent — track it inline on the model so the v1.5 iOS sprint picks it up.
This commit is contained in:
1 parent
2bb49ae764
commit
cf5d6c433a
1 file changed
+10
@@ -421,6 +421,16 @@ model Workout {
|
||||
|
||||
/// Ingest dedup. NULL externalId is distinct so two manual
|
||||
/// entries on the same day never collide here.
|
||||
///
|
||||
/// TODO(v1.5 iOS): cross-source workout dedup. The current key is
|
||||
/// (userId, source, externalId) — so the SAME workout ingested from
|
||||
/// MANUAL plus the iOS HealthKit passthrough lands two rows because
|
||||
/// `source` differs. Measurements already solved this via
|
||||
/// `pickCanonicalSourceRows()` (the read-time canonical-source
|
||||
/// picker in src/lib/analytics/source-priority.ts); workouts need
|
||||
/// the symmetric helper before the dashboard "recent workouts" tile
|
||||
/// can show one row per workout instead of one per source. Tracked
|
||||
/// for v1.5 P1 alongside the iOS app.
|
||||
@@unique([userId, source, externalId])
|
||||
/// Dashboard "recent workouts" query path.
|
||||
@@index([userId, startedAt])
|
||||
|
||||
Reference in new issue
Block a user