Skip to content

Commit

Permalink
active system count
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Aug 30, 2024
1 parent edf99e1 commit a05519a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/sys_stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ var spots = (24 * 60) / timePeriod; // the number of spots needed to keep track
async function updateActiveSystems() {
// Go through all of the Systems
let siteTotal = 0;
let activeSystems = 0;
for await (let item of System.find()) {
// go through all the systems
// if you have received some calls during that last period, make the system active
if ((callTotals[item.shortName] != undefined) && (callTotals[item.shortName] > 0)) {
item.active = true;
siteTotal += callTotals[item.shortName];
activeSystems++;
item.callAvg = callTotals[item.shortName] / timePeriod;
item.lastActive = new Date();
} else {
Expand All @@ -35,6 +37,7 @@ async function updateActiveSystems() {
await item.save();
};
console.log("Site average uploads per minute: " + siteTotal / timePeriod);
console.log("Active Systems: " + activeSystems);
}

exports.initStats = async function () {
Expand Down

0 comments on commit a05519a

Please sign in to comment.