mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-13 01:07:42 -05:00
fix active test
This commit is contained in:
@@ -13,20 +13,20 @@ async function updateActiveSystems() {
|
|||||||
// Go through all of the Systems
|
// Go through all of the Systems
|
||||||
for await (let 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 received 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();
|
||||||
} else {
|
} else {
|
||||||
item.active = false;
|
//item.active = false;
|
||||||
item.callAvg = 0;
|
item.callAvg = 0;
|
||||||
}
|
}
|
||||||
let fromDate = new Date(Date.now() - 60 * 60 * 24 * 30 * 1000);
|
let fromDate = new Date(Date.now() - 60 * 60 * 24 * 30 * 1000);
|
||||||
if (item.lastActive < fromDate) {
|
if ((item.lastActive != null) && (item.lastActive > fromDate)) {
|
||||||
item.active = false;
|
|
||||||
} else {
|
|
||||||
item.active = true;
|
item.active = true;
|
||||||
|
} else {
|
||||||
|
item.active = false;
|
||||||
}
|
}
|
||||||
await item.save();
|
await item.save();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user