mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
fix(backup): keep a medication's creation date through a portable restore
A portable export left the medication's creation instant out, so a restore stamped the restore time instead. The creation instant is where a medication's expected doses start, so the whole restored history then read as predating the medication: its missed doses dropped out of every adherence rate. The portable file now carries the creation instant as the disaster-recovery file already did, and the restore, which already honoured it, brings it back. A round trip pins both file purposes. Refs #1028
This commit is contained in:
1 parent
a6b8c61a82
commit
8642d63b82
2 files changed
+64
-1
No files matched your search
@@ -998,13 +998,17 @@ export async function buildFullBackupPayload(
|
||||
reorderLeadDays: m.reorderLeadDays,
|
||||
externalSource: m.externalSource,
|
||||
externalId: m.externalId,
|
||||
createdAt: m.createdAt.toISOString(),
|
||||
updatedAt: m.updatedAt.toISOString(),
|
||||
}
|
||||
: {}),
|
||||
name: m.name,
|
||||
dose: m.dose,
|
||||
active: m.active,
|
||||
// Both purposes carry the creation instant: it is the floor of the
|
||||
// medication's expected slots, so a restore stamped with the restore
|
||||
// time would read the whole restored history as predating the
|
||||
// medication and drop its misses from every rate (#1028).
|
||||
createdAt: m.createdAt.toISOString(),
|
||||
schedules: m.schedules.map((s) => ({
|
||||
...(disasterRecovery
|
||||
? {
|
||||
|
||||
Reference in new issue
Block a user