Remove email reporting except between May - September

This commit is contained in:
Fred Boniface
2025-10-21 10:07:34 +01:00
parent 27621458df
commit df896a8f0e
2 changed files with 3 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ export async function sendReportEmail(start, end, subject = "TrACreport Summary"
}
// Daily Report
cron.schedule('5 1 * * *', () => {
cron.schedule('5 1 * 5,6,7,8,9 *', () => {
const today = new Date();
const yesterday = new Date(today);
yesterday.setUTCDate(today.getUTCDate() - 1);
@@ -61,7 +61,7 @@ cron.schedule('5 1 * * *', () => {
});
// Weekly Report
cron.schedule('10 1 * * 1', () => {
cron.schedule('10 1 * 5,6,7,8,9 1', () => {
const today = new Date();
const end = new Date(today);
end.setUTCDate(today.getUTCDate() - 1);
@@ -71,7 +71,7 @@ cron.schedule('10 1 * * 1', () => {
})
// Monthly Report
cron.schedule('15 1 1 * *', () => {
cron.schedule('15 1 1 5,6,7,8,9 *', () => {
const today = new Date();
const end = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), 0)); // Last day of previous month
const start = new Date(Date.UTC(end.getUTCFullYear(), end.getUTCMonth(), 1)); // First day of previous month

View File

@@ -1,5 +1,4 @@
import { generateHTMLReport } from "./reportHtml.js";
import { writeFile } from "fs/promises";
import { fetchReportsInRange } from "../models/report.js";
export interface BaseReport {