fix conversion to imdb rating in JS

This commit is contained in:
ducklet 2021-08-04 17:10:44 +02:00
parent bae0415a24
commit e56ff8a6e6

View file

@ -56,7 +56,7 @@ function imdb_stdev(scores) {
}
function imdb_rating_from_score(score) {
return Math.round((score * 9) / 100 + 1)
return Math.round((score * 9) / 10 + 10) / 10
}
function imdb_rating(score) {
@ -64,7 +64,7 @@ function imdb_rating(score) {
return "-"
}
const deci = Math.round((score * 9) / 10 + 10)
const deci = 10 * imdb_rating_from_score(score)
return `${(deci / 10) | 0}.${deci % 10}`
}