Update sys_stats.js

This commit is contained in:
Luke Berndt
2023-04-07 09:57:01 -04:00
parent 70cd2cd14e
commit 70464417cc

View File

@@ -62,6 +62,13 @@ function updateActiveSystems() {
exports.initStats = function() {
// get the System Stats collection
db.get().collection("system_stats").exists(function(err, result) {
if (result) {
db.get().collection('system_stats', function(err, statsCollection) {
var cursor = statsCollection.find();
@@ -95,6 +102,17 @@ exports.initStats = function() {
}
});
});
} else {
db.get().createCollection("system_stats", function(err, res) {
if (err) {
console.log("Error creating system_stats collection");
console.log(err);
} else {
console.log('system_stats created!');
}
});
}
});
}
// keeps track of the number of calls that get uploaded with an audio file