Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nos aseguramos de que safeScore sea numérico #275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

albfernandez
Copy link
Contributor

Corregimos la ordenacion en el ranking y posiblemente otros errores que ocurran al comparar como cadenas pensando que son numeros

Fix #189

Corregimos la ordenacion en el ranking y posiblemente otros errores que ocurran al comparar como cadenas pensando que son numeros

Fix PucelaBits#189
@@ -97,15 +97,15 @@ const filenameToData = (f) => ({
.map(({ name, id }) => ({
name,
id,
safeScore: getSafeScore(filterByTerritorioId(all, id)),
safeScore: Number(getSafeScore(filterByTerritorioId(all, id))),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muchísimas gracias, @albfernandez. Tiene buena pinta la PR, hago alguna prueba más cuando saque un rato y la mergeo si está todo ok.

A priori creo que si getSafeScore ya devuelve un Number, no hace falta volverlo a convertir aquí y en la L108.

Suggested change
safeScore: Number(getSafeScore(filterByTerritorioId(all, id))),
safeScore: getSafeScore(filterByTerritorioId(all, id)),

subTerritories: territoriesLevel2
.map(filenameToData)
.filter(({ file }) => id === file.comunidad)
.map(({ file, id }) => ({ id, ...file }))
.map(({ name, id }) => ({
name,
id,
safeScore: getSafeScore(filterByTerritorioId(all, id)),
safeScore: Number(getSafeScore(filterByTerritorioId(all, id))),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aquí igual, creo que basta con el cambio a Number que has hecho en el valor de retorno de la propia función

Suggested change
safeScore: Number(getSafeScore(filterByTerritorioId(all, id))),
safeScore: getSafeScore(filterByTerritorioId(all, id)),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ordenación en el Ranking
2 participants