fix: correct import skipped count when manual entries exist
Problem: Import reported all entries as "updated" even when skipped due to WHERE clause (source != 'manual') Root cause: RETURNING returns NULL when WHERE clause prevents update, but code counted NULL as "updated" instead of "skipped" Fix: - Check if result is None → skipped (WHERE prevented update) - Check if xmax = 0 → inserted (new row) - Otherwise → updated (existing row modified) Affects: - vitals_baseline.py: Apple Health import - blood_pressure.py: Omron import Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
10772d1f80
commit
7dcab1d7a3
|
|
@ -376,7 +376,10 @@ async def import_omron_csv(
|
|||
))
|
||||
|
||||
result = cur.fetchone()
|
||||
if result and result['inserted']:
|
||||
if result is None:
|
||||
# WHERE clause prevented update (manual entry exists)
|
||||
skipped += 1
|
||||
elif result['inserted']:
|
||||
inserted += 1
|
||||
else:
|
||||
updated += 1
|
||||
|
|
|
|||
|
|
@ -357,7 +357,10 @@ async def import_apple_health_baseline(
|
|||
))
|
||||
|
||||
result = cur.fetchone()
|
||||
if result and result['inserted']:
|
||||
if result is None:
|
||||
# WHERE clause prevented update (manual entry exists)
|
||||
skipped += 1
|
||||
elif result['inserted']:
|
||||
inserted += 1
|
||||
else:
|
||||
updated += 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user