Score: Why not floats?

Mark Kretschmann markey at web.de
Sat Jan 6 14:58:43 UTC 2007


On Saturday 06 January 2007 15:21, Marc Adler wrote:
> correct me if i'm wrong but it seems like there is a little glitch in
> the scoresystem. If i'm reading this right the score is saved as an
> integer between 0 and 100. Is there a reason why this is done? The
> problem is that the current system gets stuck at some point because of
> the rounding down (i think when a song is played more than "100 -
> current score" times) and the scores can not change anymore (at least
> can no longer go up). A little (possible the most extreme) example:
>
> Lets say there is a song which was skipped 100 times. It has the current
> score 1. Now it is played completly (should add a rating of 100). So we
> end up with:
>
> newscore = ( ( prevscore * playcount ) + percentage ) / ( playcount + 1 )
> newscore = ((1 * 100) + 100 / 101) = 1.9801
>
> 1.9801 is saved as 1 in the database and we're back at the beginning. If
> the track already has a higher rating this situation happens even earlier.
> A track with an rating of 50 will not be able to reach a higher score after
> as much as 50 plays.
>
> So the questions are:
> Can i change the script for myself and save floating point numbers without
> the risk of "confusing" other program parts? Would you consider changing it
> in one of the next releases, because i think a scoresystem which gets stuck
> is probably not the best solution.

It's already fixed in SVN :)

-- 
Mark



More information about the Amarok mailing list