STATS sends scheduled emails and alerts related to reporting and overdue devices. Use the controls below to explore examples. This page links back to the main Reports module.
← Back to ReportingWeekly report email showing attachments and internal links.
Admin list of recipients per year level with quick Unsubscribe/Delete actions.
Overdue alert after 2 days—gentle reminder to follow up.
Lock escalation at day 4—advises the device will be locked.
// Nightly job
async function processEmailJobs(dateRange) {
const years = [7,8,9,10,11,12];
for (const y of years) {
const files = await renderWeeklyFiles({ year_level: y, ...dateRange }); // -> { pdf, csv }
const recipients = await listRecipients(y); // report_emails where subscribed=1
for (const to of recipients) {
await queue({ to, kind: 'weekly', files, dateRange });
}
}
// Overdue + lock alerts
const overdue = await findOverdue(2); // 2 days
const locks = await findOverdue(4); // 4 days
for (const r of overdue) await queue({ to: r.notify, kind: 'overdue', data: r });
for (const r of locks) await queue({ to: r.notify, kind: 'lock', data: r });
}