Extending this question here as I get further into statistics based tables for this system. Selecting, ranking and applying a point score based on rank
The scenario is as such. Users vote on players and give them 3 - 2 or 1 vote. This goes into a table for those votes. And looks like
| vote | points |
---------------------
| Player 1 | 3 |
| Player 1 | 2 |
| Player 1 | 1 |
| Player 1 | 3 |
| Player 2 | 3 |
| Player 2 | 2 |
| Player 2 | 1 |
| Player 2 | 3 |
| Player 3 | 3 |
| Player 4 | 2 |
This gives us an overall ranking. Players are then ranked from this table to get points assigned that goes into a final standings table, they are assigned either 3, 2 or 1 points depending on their position
1st = 3
2nd = 2
3rd = 1
If there is a tie however the players split the rest of the ranks points based on where they are positioned and how many in that rank In most cases there should only be 3 people getting points, unless there is a more than 3-way tie or a tie at 3rd etc.
So in the case above the distribution would be
player 1 = 2.5
player 2 = 2.5
player 3 = 1
player 4 = 0
This is because 2 people were tied for 1st, which means they are 1st and 2nd, and therefore split the points of coming 1st or second, but that only leaves a 3rd place so player 3 gets points but player 4, 5, 6 etc get no points.
if there was a two way tie for 3rd place they would get 1 / 2 = 0.5 and so on depending on how many there are. So its always split between positions.
Additional to this we have a further complication in that the "Vote" field is just the player ID, we get the players name by joining the "players" table on v.vote = p.ID
So users are ranked on the points they receive and then assigned a new set of points in a final standings based on their tally of points
Aucun commentaire:
Enregistrer un commentaire