Fix sync_lookback_days actually controlling the sync window
Activities: lookback_days was ignored once last_sync_at was set (since always took priority). Now lookback_days always sets the window; -1 is all-time on first sync then incremental. Wellness: lookback_days was never passed to sync_wellness at all — hardcoded 90-day cap regardless of settings. Fixed by adding lookback_days param and wiring it through from the Celery task. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -507,7 +507,10 @@ def sync_garmin_connect_user(user_id: int):
|
||||
|
||||
if cfg.sync_wellness:
|
||||
try:
|
||||
wellness_days = sync_wellness(garmin, user_id, cfg.last_sync_at, db)
|
||||
wellness_days = sync_wellness(
|
||||
garmin, user_id, cfg.last_sync_at, db,
|
||||
lookback_days=cfg.sync_lookback_days if cfg.sync_lookback_days is not None else 90,
|
||||
)
|
||||
except Exception as exc:
|
||||
errors.append(f"wellness: {exc}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user