Fixed the Mongoos schema for Stats

This commit is contained in:
Luke Berndt
2023-04-10 08:44:38 -04:00
parent fd779e91da
commit e8ee26ad4a
2 changed files with 27 additions and 10 deletions

View File

@@ -69,13 +69,13 @@ exports.listSystems = async function (req, res, next) {
const stats = await SystemStat.find({ shortName: { $in: shortNames } }).exec();
var sys_stats = {}
for (var i = 0; i < stats.length; i++) {
sys_stats[stats[i].shortName] = {};
sys_stats[stats[i].shortName]["uploadErrors"] = stats[i].uploadErrors;
sys_stats[stats[i].shortName]["callTotals"] = stats[i].callTotals;
sys_stats[stats[i].shortName].talkgroupStats= stats[i].talkgroupStats;
sys_stats[stats[i].shortName].decodeErrorsFreq = stats[i].decodeErrorsFreq;
console.log(stats[i])
sys_stats[stats[i].shortName] = {
uploadErrors: stats[i].uploadErrors,
callTotals: stats[i].callTotals,
talkgroupStats: stats[i].talkgroupStats,
decodeErrorsFreq: stats[i].decodeErrorsFreq
};
}
console.log(sys_stats["test"]);