diff --git a/cron/TripsWorker.js b/cron/TripsWorker.js index e65c16e..5c0f4a0 100644 --- a/cron/TripsWorker.js +++ b/cron/TripsWorker.js @@ -162,9 +162,9 @@ async function job() { async function tripGrouping() { console.log("Trip grouping job executed:", moment().format("YYYY-MM-DD HH:mm:ss")) - for (let i = 0; i <= 12; i++) { - const lasYearDate = moment().subtract(1, "years") - const histMonth = lasYearDate.clone().add(i, "months") + for (let i = 0; i <= 1; i++) { + const lastMonth = moment().subtract(1, "months") + const histMonth = lastMonth.clone().add(i, "months") const histYy = histMonth.format("YY") const histMm = histMonth.format("MM") const histTableName = `tracks_${histYy}${histMm}`