Files
HealthLog/src/lib/export/legacy-rmssd.ts
T
Marc-André Bombeck 8e2e4f658b fix(backup): restore pre-0420 Fitbit and Google Health HRV as RMSSD
A backup written before migration 0420 files Fitbit and Google Health
HRV as HEART_RATE_VARIABILITY, and the restore wrote it back verbatim,
undoing the migration for the account (and able to duplicate an
HRV_RMSSD row of the same night, since type is part of the unique key).
The restore now applies the same move: those rows come back as
HRV_RMSSD, a legacy row whose RMSSD twin the file also holds is skipped,
and SDNN personal records set by them are left out as the migration
deleted them.
2026-10-21 16:25:25 +02:00

21 lines
547 B
TypeScript

/** The sources whose HRV migration 0420 refiled from SDNN to RMSSD. */
export const LEGACY_RMSSD_SOURCES: ReadonlySet<string> = new Set([
"FITBIT",
"GOOGLE_HEALTH",
]);
/**
* A Fitbit or Google Health HRV row a file written before migration 0420
* still files as `HEART_RATE_VARIABILITY` (SDNN). It is RMSSD.
*/
export function isLegacyRmssdRow(row: {
type: string;
source?: string | null;
}): boolean {
return (
row.type === "HEART_RATE_VARIABILITY" &&
row.source != null &&
LEGACY_RMSSD_SOURCES.has(row.source)
);
}