mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
fix(admin): count every record class in the upload summary
The total shown after a backup upload skipped the nutrient day totals, so a file that carried and restored them reported fewer records than it held. Same defect as the payload gaps this branch closes, on the reporting side. Counts the nutrient days, the health profile and the custom metrics with their readings.
This commit is contained in:
1 parent
faa89ef54b
commit
e69e0b3941
1 file changed
+16
-1
@@ -239,6 +239,13 @@ export function BackupsSection() {
|
||||
familyHistory?: number;
|
||||
workouts?: number;
|
||||
documents?: number;
|
||||
// Optional for the same reason: a file written before each of these
|
||||
// rode the wire carries no key, and an absent key must total as
|
||||
// nothing rather than break the count.
|
||||
nutrientDays?: number;
|
||||
healthProfile?: number;
|
||||
customMetrics?: number;
|
||||
customMetricEntries?: number;
|
||||
};
|
||||
}>("/api/admin/backups/upload", { method: "POST", body: fd });
|
||||
},
|
||||
@@ -257,7 +264,15 @@ export function BackupsSection() {
|
||||
(data.summary.allergies ?? 0) +
|
||||
(data.summary.familyHistory ?? 0) +
|
||||
(data.summary.workouts ?? 0) +
|
||||
(data.summary.documents ?? 0);
|
||||
(data.summary.documents ?? 0) +
|
||||
// The count the admin is shown has to be the count the file carries.
|
||||
// The nutrient day totals were added to the payload and never to this
|
||||
// sum, so an upload that restored them reported fewer records than it
|
||||
// held — a smaller version of the same defect, on the reporting side.
|
||||
(data.summary.nutrientDays ?? 0) +
|
||||
(data.summary.healthProfile ?? 0) +
|
||||
(data.summary.customMetrics ?? 0) +
|
||||
(data.summary.customMetricEntries ?? 0);
|
||||
toast.success(
|
||||
t("admin.section.backups.uploadSuccess", { count: String(total) }),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user