Commit 051f1e3
committed
fix(workouts): stop re-derivation wiping user-confirmed/corrected types
detectStoreDay and processUser both DELETE auto sessions before re-inserting,
and setWorkoutType leaves source='auto' — so a confirmed/corrected workout was
deleted on every re-derive (the */10 sweep, every close_day) and reset to the
model's guess, erasing the calibration ledger within ~10 min. The INSERT's
ON CONFLICT preserve-corrected clause never fired because the row was already
gone in the same batch transaction.
Exclude type_source IN ('confirmed','corrected') from both DELETEs so the
labelled row survives (ON CONFLICT then preserves type/confidence while
refreshing the model metrics), and add it to the overlap-skip set so a
baseline-drift start_ts shift can't insert a duplicate model row over the
user's label.1 parent 884540e commit 051f1e3
2 files changed
Lines changed: 21 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
393 | 403 | | |
394 | | - | |
| 404 | + | |
395 | 405 | | |
396 | 406 | | |
397 | 407 | | |
| 408 | + | |
398 | 409 | | |
399 | 410 | | |
400 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
392 | 395 | | |
393 | | - | |
| 396 | + | |
394 | 397 | | |
395 | 398 | | |
396 | 399 | | |
397 | 400 | | |
398 | 401 | | |
399 | | - | |
| 402 | + | |
400 | 403 | | |
401 | 404 | | |
402 | 405 | | |
| |||
0 commit comments