I have 2 models,
Player
- id: int
- name: string
Ball
- type: string
- player_id: int
Basically the idea is that a player can posses certain number of balls. The type of the ball can be BIG or SMALL (stored as string value) in ball.type
Now I would like to sort the players based on a calculated reputation. The formula for reputation is as follows
reputation = No of Big balls x 10 + No of Small balls
So for e.g. the reputation of a player with one big and one small ball would be 11.
Could someone give an idea on how to order users based on this reputation? Thanks for your help.