phpratingdrupal-fivestar

PHP voting intensity/force?


Well I'm thinking of adding a rating feature to my application where members can vote between 1-5 (this is the $rating) , and I display the average score like $score = $number_of_voters / $rating. Where $number_of_voters is the total count of members voted on that specific item, and $rating is the total rating for that specific item.

That way the $score can't be higher then 5 (which its out of).

However I'm thinking of integrating a voting intensity/force according to the users RPG level (which is a number between 1-8 which gradually can increase - which each member has assigned), so if for example they voted and their RPG level was 1 the average score would'nt be too different from the previous (wouldnt effect it too much) however if it was something like 8 then it would effect it more? (too summarise their RPG level would be considered internally when voting).

But not sure how to proceed (how to integrate/implement) without effecting the intial specification (ie. I don't want the score going higher then 5 (want it to be $score <= 5)).


Solution

  • To address your immediate question, you can multiply by a fractional weight 0-1. If you have various levels, you can get this weight by dividing the user's level by the maximum level.

    But before you get started coding, you should read How Not To Sort By Average Rating so that you avoid some of the common pitfalls with this kind of voting system.