From 29aecac3a18d6b7f9dc735986590611271e77fc5 Mon Sep 17 00:00:00 2001 From: Felipe Garcia Date: Sat, 27 Apr 2024 11:34:54 +0200 Subject: [PATCH] Fix typo in statistics-service.js --- statistics/statisticsservice/statistics-service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statistics/statisticsservice/statistics-service.js b/statistics/statisticsservice/statistics-service.js index cc8b7c2c..919b8690 100644 --- a/statistics/statisticsservice/statistics-service.js +++ b/statistics/statisticsservice/statistics-service.js @@ -65,7 +65,7 @@ app.post('/addStatistic', async (req, res) => { let roundedAccuracy=0; const rankedUsers = users.map(user => { let roundedAccuracy; - if(user.wrongAnswers === 0 & user.rigthAnswers !=0) return { username: user.username, accuracy: 100 }; // Evitar divisiĆ³n por cero (no se han jugado partidas + if(user.wrongAnswers === 0 && user.rigthAnswers !=0) return { username: user.username, accuracy: 100 }; // Evitar divisiĆ³n por cero (no se han jugado partidas const accuracy = (user.rigthAnswers / (user.wrongAnswers + user.rigthAnswers )) * 100; // Calcular porcentaje de aciertos if (isNaN(accuracy)) { roundedAccuracy = 0; // Asignar 0 si accuracy es NaN