Greasy Fork is available in English.

Discussions » Development

What's is the most correct way to get the correct average score?

§
Gönderildi: 13.11.2020
I'm asking this question for this script https://jsfiddle.net/60e8jL5d/
https://greasyfork.org/en/scripts/413661-show-the-average-score-for-animes-mangas-instead-of-n-a

Can I just change the number 10 on these lines
for(i=0;i<10;i++){
result = result + stats[i]*(10-i);
to the number of scores?

Example; An anime has only these scores

7
28.9% (2002 votes)
6
19.0% (1315 votes)
5
8.7% (604 votes)
4
4.8% (334 votes)
3
2.5% (174 votes)
2
1.2% (84 votes)
1
1.8% (126 votes)

So I replace the number 10 on the script to 7, would that give the correct score? Or I do need to add this?
10
0.0% (0 votes)
9
0.0% (0 votes)
8
0.0% (0 votes)

The two ways give very different average scores, I'm not sure which one is the most correct way to do this

Post reply

Sign in to post a reply.