add showboaters
This commit is contained in:
@@ -1166,11 +1166,12 @@ async function seedDemoCompletions(): Promise<void> {
|
||||
const startDate = addDays(todayDate, -20);
|
||||
|
||||
// Track per-member-per-week totals for weekly_history
|
||||
type WeekKey = string; // "YYYY-MM-DD" (Monday)
|
||||
type WeekKey = string; // "YYYY-MM-DD" (week start: day after payday)
|
||||
const weekTotals: Record<
|
||||
string,
|
||||
Record<string, { points: number; money: number; count: number }>
|
||||
> = {};
|
||||
const demoPayday = fam.payday ?? 1;
|
||||
|
||||
for (const member of members) {
|
||||
const profile = COMPLETION_PROFILES[member.name] || COMPLETION_PROFILES['Jalipo'];
|
||||
@@ -1180,10 +1181,14 @@ async function seedDemoCompletions(): Promise<void> {
|
||||
const ds = dateStr(day);
|
||||
const dow = day.getUTCDay(); // 0=Sun
|
||||
|
||||
// Compute week start (Monday) for weekly_history tracking
|
||||
const weekMonday = new Date(day);
|
||||
weekMonday.setUTCDate(weekMonday.getUTCDate() - ((weekMonday.getUTCDay() + 6) % 7));
|
||||
const ws = dateStr(weekMonday);
|
||||
// Compute week start (payday-anchored: weeks close on payday, so
|
||||
// the bucket opens the day after — same rule as weekStart()).
|
||||
const dowNum = day.getUTCDay(); // 0=Sun
|
||||
const sincePayday = (((dowNum - demoPayday) % 7) + 7) % 7;
|
||||
const back = sincePayday === 0 ? 6 : sincePayday - 1;
|
||||
const wsDay = new Date(day);
|
||||
wsDay.setUTCDate(wsDay.getUTCDate() - back);
|
||||
const ws = dateStr(wsDay);
|
||||
|
||||
if (!weekTotals[member.id]) weekTotals[member.id] = {};
|
||||
if (!weekTotals[member.id][ws]) weekTotals[member.id][ws] = { points: 0, money: 0, count: 0 };
|
||||
@@ -1196,8 +1201,9 @@ async function seedDemoCompletions(): Promise<void> {
|
||||
);
|
||||
|
||||
for (const chore of memberChores) {
|
||||
// Weekly chores: only complete on Monday (dow=1)
|
||||
if (chore.frequency === 'weekly' && dow !== 1) continue;
|
||||
// Weekly chores: only complete on the week's first day
|
||||
// (day after payday).
|
||||
if (chore.frequency === 'weekly' && dow !== (demoPayday + 1) % 7) continue;
|
||||
|
||||
const prob = dayProfile[chore.customName] || dayProfile.default;
|
||||
const rng = demoRng(
|
||||
|
||||
Reference in New Issue
Block a user