diff --git a/backend/controllers/calls.js b/backend/controllers/calls.js index 77090e6..15f8c27 100644 --- a/backend/controllers/calls.js +++ b/backend/controllers/calls.js @@ -105,7 +105,7 @@ async function build_filter(filter_type, code, start_time, direction, shortName, const group = await Group.findOne({ 'shortName': shortName, '_id': ObjectId.createFromHexString(code) }).exec(); if (!group) { - console.warn("[" + shortName + "] Error - build_filter() group is null " + err); + console.warn("[" + shortName + "] Error - build_filter() group is null "); res.contentType('json'); res.status(404); res.send(JSON.stringify({ diff --git a/backend/sys_stats.js b/backend/sys_stats.js index 2134961..e7d96dc 100644 --- a/backend/sys_stats.js +++ b/backend/sys_stats.js @@ -155,11 +155,17 @@ exports.shiftStats = async function () { if (decodeErrorsFreq.hasOwnProperty(shortName)) { var sysErrors = decodeErrorsFreq[shortName]; + // for each freq in that systems stats for (var freqNum in sysErrors) { if (sysErrors.hasOwnProperty(freqNum)) { var freqErrors = sysErrors[freqNum]; + if ((freqErrors.errorHistory == undefined) || (freqErrors.spikeHistory == undefined)) { + console.error("[" + shortName +"] Skipping stat for freq: " + freqNum); + console.error(freqErrors); + continue; + } // move the history for that freq back for (let j = spots - 1; j > 0; j--) { let i = j - 1; @@ -204,6 +210,11 @@ exports.shiftStats = async function () { if (sysTalkgroupStats.hasOwnProperty(talkgroupNum)) { var tg = sysTalkgroupStats[talkgroupNum]; var tgHistoryTotal = 0; + if ((tg.callCountHistory == undefined) || (tg.callAvgLenHistory== undefined)) { + console.error("[" + shortName +"] Skipping stat for tg: " + talkgroupNum); + console.error(tg); + continue; + } // move the history for that talkgroup back for (let j = spots - 1; j > 0; j--) { let i = j - 1;