bonuses: templates full-width list, drag-create modal, auto-evaluate, outstanding/completed states

This commit is contained in:
JCEEE
2026-07-30 15:27:03 +01:00
parent c55c090260
commit 8834281b4d
8 changed files with 524 additions and 676 deletions
+4 -6
View File
@@ -454,7 +454,7 @@ app.get("/api/admin/:famId/weekly-summary", requireAdmin, async (c) => {
}
}
const summaries = members.items.map((m: any) => {
const summaries = await Promise.all(members.items.map(async (m: any) => {
const memberAssignments = assignedList.filter((a: any) => a.memberId === m.id);
const memberCompletions = completionsList.filter((c: any) => c.memberId === m.id);
@@ -505,11 +505,9 @@ app.get("/api/admin/:famId/weekly-summary", requireAdmin, async (c) => {
dayPoints,
dayCompletions,
};
});
}));
return c.json({ weekStart: ws, daysInWeek, summaries });
return c.json({ weekStart: ws, summaries });
} catch (err) { return handleError(c, err); }
});
@@ -749,7 +747,7 @@ async function evaluateFam(famId: string): Promise<void> {
famId, memberId: m.id, bonusConfigId: cfg.id,
label, value: Number(cfg.rewardValue) || 0,
rewardType: cfg.rewardType,
claimed: cfg.rewardType === "points",
status: cfg.rewardType === "points" ? "claimed" : "unclaimed",
claimedAt: cfg.rewardType === "points" ? now : null,
date: now.slice(0, 10),
});
@@ -807,7 +805,7 @@ async function evaluateFam(famId: string): Promise<void> {
: `${cfg.name} ${cfg.rewardValue}`;
const now = new Date().toISOString();
await pb.create("rewards", {
famId, memberId: m.id, bonusConfigId: cfg.id,
famId, memberId: winner.memberId, bonusConfigId: cfg.id,
label, value: Number(cfg.rewardValue) || 0,
rewardType: cfg.rewardType,
status: cfg.rewardType === "points" ? "claimed" : "unclaimed",