mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-16 10:47:32 -05:00
small fixes
This commit is contained in:
@@ -15,20 +15,19 @@ async function updateActiveSystems() {
|
|||||||
// Go through all of the Systems
|
// Go through all of the Systems
|
||||||
|
|
||||||
|
|
||||||
for await (const item of System.find()) {
|
for await (let item of System.find()) {
|
||||||
// go through all the systems
|
// go through all the systems
|
||||||
// if you have recieved some calls during that last period, make the system active
|
// if you have recieved some calls during that last period, make the system active
|
||||||
if ((callTotals[item.shortName] != undefined) && (callTotals[item.shortName][0] > 0)) {
|
if ((callTotals[item.shortName] != undefined) && (callTotals[item.shortName][0] > 0)) {
|
||||||
item.active = true;
|
item.active = true;
|
||||||
item.callAvg = callTotals[item.shortName][0] / timePeriod;
|
item.callAvg = callTotals[item.shortName][0] / timePeriod;
|
||||||
item.lastActive = new Date();
|
item.lastActive = new Date();
|
||||||
await item.Save();
|
await item.save();
|
||||||
} else {
|
} else {
|
||||||
item.active = false;
|
item.active = false;
|
||||||
item.callAvg = 0;
|
item.callAvg = 0;
|
||||||
await item.save();
|
await item.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,23 +36,24 @@ exports.initStats = async function () {
|
|||||||
|
|
||||||
|
|
||||||
for await (const item of SystemStat.find()) {
|
for await (const item of SystemStat.find()) {
|
||||||
|
const obj = item.toObject();
|
||||||
// Talkgroup Stats
|
// Talkgroup Stats
|
||||||
if (item.talkgroupStats != undefined) {
|
if (item.talkgroupStats != undefined) {
|
||||||
talkgroupStats[item.shortName] = item.talkgroupStats;
|
talkgroupStats[item.shortName] = obj.talkgroupStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode Errors
|
// Decode Errors
|
||||||
if (item.decodeErrorsFreq != undefined) {
|
if (item.decodeErrorsFreq != undefined) {
|
||||||
decodeErrorsFreq[item.shortName] = item.decodeErrorsFreq;
|
decodeErrorsFreq[item.shortName] = obj.decodeErrorsFreq;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload Error Totals
|
// Upload Error Totals
|
||||||
if (item.uploadErrors != undefined) {
|
if (item.uploadErrors != undefined) {
|
||||||
uploadErrors[item.shortName] = item.uploadErrors;
|
uploadErrors[item.shortName] = obj.uploadErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.callTotals != undefined) {
|
if (item.callTotals != undefined) {
|
||||||
callTotals[item.shortName] = item.callTotals;
|
callTotals[item.shortName] = obj.callTotals;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,6 @@ exports.shiftStats = async function () {
|
|||||||
|
|
||||||
if ((freqErrors.errorHistory == undefined) || (freqErrors.spikeHistory == undefined)) {
|
if ((freqErrors.errorHistory == undefined) || (freqErrors.spikeHistory == undefined)) {
|
||||||
console.error("[" + shortName + "] Skipping stat for freq: " + freqNum);
|
console.error("[" + shortName + "] Skipping stat for freq: " + freqNum);
|
||||||
console.error(freqErrors);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// move the history for that freq back
|
// move the history for that freq back
|
||||||
@@ -212,7 +211,6 @@ exports.shiftStats = async function () {
|
|||||||
var tgHistoryTotal = 0;
|
var tgHistoryTotal = 0;
|
||||||
if ((tg.callCountHistory == undefined) || (tg.callAvgLenHistory == undefined)) {
|
if ((tg.callCountHistory == undefined) || (tg.callAvgLenHistory == undefined)) {
|
||||||
console.error("[" + shortName + "] Skipping stat for tg: " + talkgroupNum);
|
console.error("[" + shortName + "] Skipping stat for tg: " + talkgroupNum);
|
||||||
console.error(tg);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// move the history for that talkgroup back
|
// move the history for that talkgroup back
|
||||||
|
|||||||
Reference in New Issue
Block a user