biep badabup fix #17 und sysinfos

Took 24 minutes
This commit is contained in:
2023-02-06 21:26:29 +01:00
parent 053fd3e260
commit 00a53c05fb
3 changed files with 19 additions and 18 deletions

View File

@ -62,26 +62,28 @@ export class WebSocketHandler {
return new Promise(async resolve => {
let counts: any[] = [];
for (let drink of (await Drink.find())) {
// @ts-ignore
let drinks = await Drink.find();
for (let drink of drinks) {
console.log(drink._id);
console.log( (await Job.countDocuments( )) );
let count = await Job.countDocuments({drink: drink._id});
console.log(count);
counts.push([drink, count]);
}
counts.sort((a, b) => {
// @ts-ignore
if (a[1] < b[1])
counts = counts.sort((a, b) => {
if (a[1] > b[1])
return -1;
// @ts-ignore
else if (a[1] > b[1])
else if (a[1] < b[1])
return 1;
else
return 0;
});
console.debug(counts);
let stats = {
"drinks_finished": (await Job.countDocuments({successful: true})),
"drink_most": (counts.length == 0) ? "Keiner" : counts[0][0].name,