mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 06:32:03 +00:00
feat(medications): record scheduled doses automatically
This commit is contained in:
1 parent
5919a93c29
commit
c94e109bf0
37 files changed
+1105
-15
No files matched your search
@@ -471,6 +471,10 @@ function serialiseIntakeEvent(e: BackupIntakeEvent, disasterRecovery: boolean) {
|
||||
takenAt: e.takenAt?.toISOString() ?? null,
|
||||
skipped: e.skipped,
|
||||
source: e.source,
|
||||
// v1.42.2 — both purposes: the history labels the dose "recorded
|
||||
// automatically", and a restore that dropped the marker would relabel
|
||||
// it as one the person confirmed.
|
||||
autoRecorded: e.autoRecorded,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1081,6 +1085,11 @@ export async function buildFullBackupPayload(
|
||||
// record only. Both purposes carry it: a restore that dropped it would
|
||||
// start reminding them about a medication they chose not to track.
|
||||
trackIntake: m.trackIntake,
|
||||
// v1.42.2 — the person's choice to have doses recorded for them, and
|
||||
// the floor before which none is. Both purposes: a restore without
|
||||
// them would start reminding again, or fill history it never owned.
|
||||
autoMarkTaken: m.autoMarkTaken,
|
||||
autoMarkTakenSince: m.autoMarkTakenSince?.toISOString() ?? null,
|
||||
// Both purposes: the category is something the person chose.
|
||||
category: categoryByMedication[m.id] ?? "OTHER",
|
||||
// Both purposes carry the creation instant: it is the floor of the
|
||||
|
||||
@@ -1232,6 +1232,15 @@ export async function restoreBackup(
|
||||
oneShot: m.oneShot ?? false,
|
||||
asNeeded: m.asNeeded ?? false,
|
||||
trackIntake: m.trackIntake ?? true,
|
||||
// v1.42.2 — an option that is on always carries its floor; a
|
||||
// file that has the flag without one starts it at the restore,
|
||||
// so the auto-take pass never fills history it did not own.
|
||||
autoMarkTaken: m.autoMarkTaken ?? false,
|
||||
autoMarkTakenSince: m.autoMarkTaken
|
||||
? m.autoMarkTakenSince
|
||||
? new Date(m.autoMarkTakenSince)
|
||||
: new Date()
|
||||
: null,
|
||||
deliveryForm: m.deliveryForm ?? "ORAL",
|
||||
trackInjectionSites: m.trackInjectionSites ?? false,
|
||||
allowedInjectionSites: m.allowedInjectionSites ?? [],
|
||||
@@ -1603,6 +1612,7 @@ export async function restoreBackup(
|
||||
takenAt: e.takenAt ? new Date(e.takenAt) : null,
|
||||
skipped: e.skipped ?? false,
|
||||
autoMissed: e.autoMissed ?? false,
|
||||
autoRecorded: e.autoRecorded ?? false,
|
||||
attributionSource: e.attributionSource ?? "AUTO",
|
||||
source: e.source ?? "WEB",
|
||||
idempotencyKey: e.idempotencyKey ?? null,
|
||||
|
||||
Reference in new issue
Block a user