mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-10-22 05:54:10 -04:00
A verse date is a player's local calendar day, spanning D-1 10:00Z (UTC+14) through D+1 12:00Z (UTC-12). The old UTC end-of-day cutoff both dropped late-night finishes in negative timezones and could persist a partial day. - Scope snapshot loads by the verse date column; use completedBefore only to pin an in-progress point-in-time build. - Gate persistence on isDayClosed (D+1 12:00Z); open days are computed live and never written. - Build the cron snapshot for latestClosedDate instead of EST yesterday, and read the same date for the community page. - Add all-time best single day to snapshot totals. - Bump PAYLOAD_SCHEMA_VERSION to 4 and extend snapshot/window tests.
24 lines
893 B
TypeScript
24 lines
893 B
TypeScript
import type { PageServerLoad } from './$types';
|
|
import { ensureSnapshot } from '$lib/server/stats/snapshot';
|
|
import { latestClosedDate } from '$lib/server/stats/dates';
|
|
|
|
/**
|
|
* Slim public community widget. Reads the latest completed daily snapshot and
|
|
* exposes only safe aggregates (no retention, churn, signup or revenue data).
|
|
*/
|
|
export const load: PageServerLoad = async () => {
|
|
const snapshot = await ensureSnapshot(latestClosedDate());
|
|
const payload = snapshot.payload;
|
|
|
|
return {
|
|
asOfDate: payload.asOfDate,
|
|
completions: payload.totals.completions,
|
|
players: payload.totals.players,
|
|
weeklyPlayers: payload.activity.wau,
|
|
monthlyPlayers: payload.activity.mau,
|
|
yesterdayCompletions: payload.totals.yesterdayCompletions,
|
|
yesterdayAvgGuesses: payload.totals.yesterdayAvgGuesses,
|
|
bestDayAllTime: payload.totals.bestDay,
|
|
calendar: payload.habit.calendar.slice(-90)
|
|
};
|
|
}; |