Files
HealthLog/src/lib/onboarding/disclaimer.ts
T
Marc-André Bombeck 3b1314d1b0 Enforce the reminder nag cap, compare the disclaimer version, drop the unread analytics columns
- The daily Coach sweep now charges each ignored day against
  surfaceCount and auto-dismisses at three — the cap the schema comment
  promised since v1.22 but nothing enforced.
- The welcome gate compares the stored disclaimer acknowledgment
  version against the current one, so revised disclaimer text
  re-prompts; /api/auth/me carries the version for the client.
- slope90 and anomalyCount leave the analytics wire: slope90 had no
  reader anywhere (computed on every request, in SQL twice), and the
  slim path could never compute anomalyCount (it always reported 0).
  anomalyCount stays as an in-process field on summarize() for the
  insights feature builder, which is its only real consumer.
2026-08-14 05:19:05 +02:00

25 lines
1014 B
TypeScript

/**
* v1.18.6 (DISC-02) — the one-time medical-disclaimer acknowledgment version.
*
* The user row stores exactly which copy was acknowledged, so a future
* material wording change can bump this constant to re-prompt. Keep it in lockstep with the
* `onboarding.disclaimer.*` i18n copy — bump on a substantive text change,
* not on a typo fix.
*/
export const DISCLAIMER_VERSION = "2026-06-18";
/**
* Whether a stored acknowledgment covers the CURRENT disclaimer text.
*
* The welcome gate pre-checks its checkbox (and skips the re-record) only
* when this holds. Until v1.37.19 the gate looked at the timestamp alone,
* which meant the version column was written but never compared — bumping
* `DISCLAIMER_VERSION` could not re-prompt anyone.
*/
export function isDisclaimerAcknowledgmentCurrent(
acknowledgedAt: string | Date | null | undefined,
acknowledgedVersion: string | null | undefined,
): boolean {
return acknowledgedAt != null && acknowledgedVersion === DISCLAIMER_VERSION;
}