diff --git a/index.js b/index.js index f11fb56..abb306a 100644 --- a/index.js +++ b/index.js @@ -105,6 +105,7 @@ function updateRecords(callStats, records) { // Update monthly totals if (!records.monthlyTotals) records.monthlyTotals = {}; + if (!records.monthlyTotals[yesterday.getFullYear().toString()]) records.monthlyTotals[yesterday.getFullYear().toString()] = {}; records.monthlyTotals[yesterday.getFullYear().toString()][yesterday.getMonth().toString()] = callStats.totalCallsThisMonth; if (isNewRecord) {