diff --git a/src/lib/fitbit/client.ts b/src/lib/fitbit/client.ts index 46b6a62b5..ded8403fd 100644 --- a/src/lib/fitbit/client.ts +++ b/src/lib/fitbit/client.ts @@ -351,8 +351,6 @@ export const FITBIT_DATA_TYPES = { exercise: { path: "exercise", filter: "exercise", timeField: "interval" }, } as const satisfies Record; -export type FitbitDataTypeKey = keyof typeof FITBIT_DATA_TYPES; - /** Google Health `DataPoint` — value object is type-keyed + carries a time anchor. */ export interface FitbitDataPoint { [key: string]: unknown; diff --git a/src/lib/fitbit/sync-sleep.ts b/src/lib/fitbit/sync-sleep.ts index ff36521ba..77451be6d 100644 --- a/src/lib/fitbit/sync-sleep.ts +++ b/src/lib/fitbit/sync-sleep.ts @@ -16,7 +16,12 @@ * A per-data-class 403 soft-skips the resource — the sleep bundle is granted * independently of activity / metrics in the Google consent flow. */ -import { FITBIT_DATA_TYPES, fetchDataPoints, mapSleepSession } from "./client"; +import { + FITBIT_ACTIVITY_PAGE_SIZE, + FITBIT_DATA_TYPES, + fetchDataPoints, + mapSleepSession, +} from "./client"; import { getValidToken, handleCollectionFetchError, @@ -43,7 +48,7 @@ export async function syncUserSleep( FITBIT_DATA_TYPES.sleep, tokenInfo.accessToken, "fetchSleep", - { start, pageSize: 25 }, + { start, pageSize: FITBIT_ACTIVITY_PAGE_SIZE }, ); } catch (err) { return handleCollectionFetchError("fetchSleep", userId, err); diff --git a/src/lib/fitbit/sync-workout.ts b/src/lib/fitbit/sync-workout.ts index 2dc3cf1e3..7fa923084 100644 --- a/src/lib/fitbit/sync-workout.ts +++ b/src/lib/fitbit/sync-workout.ts @@ -15,6 +15,7 @@ * granted independently in the Google consent flow. */ import { + FITBIT_ACTIVITY_PAGE_SIZE, FITBIT_DATA_TYPES, fetchDataPoints, mapWorkout, @@ -45,7 +46,7 @@ export async function syncUserWorkout( FITBIT_DATA_TYPES.exercise, tokenInfo.accessToken, "fetchExercise", - { start, pageSize: 25 }, + { start, pageSize: FITBIT_ACTIVITY_PAGE_SIZE }, ); } catch (err) { return handleCollectionFetchError("fetchExercise", userId, err); diff --git a/src/lib/insights/mood-aggregates.ts b/src/lib/insights/mood-aggregates.ts index 0ff61743e..d35e6bb37 100644 --- a/src/lib/insights/mood-aggregates.ts +++ b/src/lib/insights/mood-aggregates.ts @@ -724,12 +724,13 @@ export function computeBetterDays( export const CROSSTAB_FDR_Q = 0.1; /** - * Per-side day floors for the crosstab — reuse the influence floors so a - * tag needs the same defensible present/absent support before a metric - * delta surfaces. + * Per-side day floors for the crosstab — kept in step with the influence + * floors (`INFLUENCE_MIN_PRESENT_DAYS` / `INFLUENCE_MIN_ABSENT_DAYS`) so a tag + * needs the same defensible present/absent support before a metric delta + * surfaces. Declared independently so the crosstab surface owns its own floor. */ -export const CROSSTAB_MIN_PRESENT_DAYS = INFLUENCE_MIN_PRESENT_DAYS; -export const CROSSTAB_MIN_ABSENT_DAYS = INFLUENCE_MIN_ABSENT_DAYS; +export const CROSSTAB_MIN_PRESENT_DAYS = 5; +export const CROSSTAB_MIN_ABSENT_DAYS = 5; /** Max rows surfaced across the whole crosstab so the surface stays scannable. */ export const CROSSTAB_MAX_ROWS = 8;