Skip to content

Commit

Permalink
Fix typo in statistics-service.js
Browse files Browse the repository at this point in the history
  • Loading branch information
UO285267 committed Apr 27, 2024
1 parent be8267b commit 29aecac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion statistics/statisticsservice/statistics-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 29aecac

Please sign in to comment.