feat: přidána midnight snack
feat: přidány statistiky pohybu
This commit is contained in:
1 parent
8dac67bdd1
commit
f1ce3ff297
13 files changed
+833
-163
No files matched your search
@@ -5,6 +5,7 @@ import {
|
||||
import getStorage from "./storage";
|
||||
import { addActivities, getActivityDay, getTotalQuantity, isActivityUnit } from "./activities";
|
||||
import { BadRequestError, NotFoundError, isValidIsoDate } from "./utils";
|
||||
import { recordWorkoutPlan } from "./workoutPlans";
|
||||
|
||||
const storage = getStorage();
|
||||
|
||||
@@ -280,6 +281,19 @@ export const applyWorkoutTemplate = async (login: string, id: unknown, date: unk
|
||||
}));
|
||||
|
||||
await addActivities(login, date, entries);
|
||||
await recordWorkoutPlan(login, date, {
|
||||
templateId: template.id,
|
||||
templateName: template.name,
|
||||
appliedAt: now,
|
||||
items: entries.map(entry => ({
|
||||
entryId: entry.id,
|
||||
name: entry.name,
|
||||
unit: entry.unit,
|
||||
quantity: entry.quantity,
|
||||
...(entry.sets != null ? { sets: entry.sets } : {}),
|
||||
calories: entry.calories ?? 0,
|
||||
})),
|
||||
});
|
||||
return date;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user