formatDate special-cased only French, so Danish users saw US
mm/dd/yyyy; formatDateTime mixed a manual French format with
toLocaleString() (OS-locale dependent) for everyone else. Both now use
Intl.DateTimeFormat with a fixed app-language -> BCP-47 map (en-US,
fr-FR, da-DK — same mapping as useSpeech), 2-digit day/month so output
stays deterministic per language: en 03/15/2026, fr 15/03/2026,
da 15.03.2026. Adds a Danish format test.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
session_item.item_id is polymorphic (no FK), so deleting an exercise or
combo used in a session left orphaned rows that the INNER JOIN in
getItems silently hid. Exercise/combo deletes now also remove their
session_item rows in one transaction. Delete confirmations on the
exercise/combo/session detail views now include usage counts (sessions/
combos using an exercise, sessions using a combo, collections containing
a session) via new count helpers and deleteConfirmUsage keys (EN/FR/DA).
Confirm stays informative, not blocking, consistent with the existing
history warning.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The 5 sequential UPDATEs could half-rename the database if a renamed
title collided with an existing one (UNIQUE constraint) mid-way. They
now go through db.batch(), which rolls back on error. SettingsView
shows a translated error (new import.suffixRenameFailed key, EN/FR/DA)
instead of the raw constraint message. Test seeds a colliding title and
asserts the rename fails with nothing renamed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Restoring a backup copied the backup's schema_version into the live DB.
Once SCHEMA_VERSION moves past 1, restoring an older backup (already
adapted to the current schema by the migration scripts) would leave an
old stamp, so the next launch re-runs migrations against an
already-adapted schema and blocks the app. schema_version is now
excluded from the restore copy; the live stamp is correct by
construction. Regression test tampers a backup's stamp and asserts the
live one survives.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Logs whose id already exists locally were re-inserted as-is, producing a
PRIMARY KEY violation per log that surfaced as errors in the import
report. They are now counted as skipped (execution logs are immutable
history — skip is always the right resolution). Adds the missing
regression test: re-import a full export without deleting anything.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getDistinctSessionDays() now filters on status = 'completed' like every
other stat query, so starting and immediately exiting a session does not
extend the streak. Adds a regression test (completed today + aborted
yesterday => streak 1).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>