bla
This commit is contained in:
parent
b9cff4e461
commit
971b390758
1 changed files with 10 additions and 1 deletions
11
stats.js
11
stats.js
|
@ -4,12 +4,18 @@ let PrankData = JSON.parse(fs.readFileSync("prankdata.txt"));
|
|||
let nbPrank = 0;
|
||||
let nbCrepe = 0;
|
||||
let meanCrepe = 0;
|
||||
let userPrank = 0;
|
||||
|
||||
for (var uid in PrankData) {
|
||||
if (PrankData[uid].type == "crêpe") {
|
||||
if (PrankData[uid].state == "Done") {
|
||||
nbPrank ++;
|
||||
nbCrepe += parseInt(PrankData[uid].amount)
|
||||
if (userPrank[PrankData[uid].creator]) {
|
||||
userPrank[PrankData[uid].creator] += nbCrepe;
|
||||
} else {
|
||||
userPrank[PrankData[uid].creator] = nbCrepe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +24,7 @@ meanCrepe = nbCrepe / nbPrank;
|
|||
|
||||
console.log("Nombre de mission mission achevé: " + nbPrank)
|
||||
console.log("Nombre de crêpe servis: " + nbCrepe)
|
||||
console.log("Nombre moyen de crêpe par demande: " + meanCrepe)
|
||||
console.log("Nombre moyen de crêpe par demande: " + meanCrepe + "\n")
|
||||
for (var user in userPrank) {
|
||||
console.log(user + "a commandé" + userPrank[user] + "crê$e")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue