I'm trying to implement bonus calculation system to my website. It should calculate bonuses for users.
This is how it should work:
- User1 can get 2% bonus
- User2 has for example 100 points
- The bonus for User1 is calculated as User2 points * User1 bonus % * level x%
There are different levels of bonuses.
Level1 x% bonus: User1 gets amount x% of bonus from three users who have registered after User1. So User1 gets bonus from User2, User3 and User4.
Level2 y% bonus: User1 gets amount y% of bonus from nine who have registered after User1, User2, User3 and User4. Like this: User1 gets bonus from User5, User6, User7, User8, User9, User10, User11 and User 12.
There are 9 levels and it continues like explained above. Users are multiplicated by 3 so users where User1 gets bonuses are: 3, 9, 27, 81.. etc.
Any ideas how to implement bonus calculation? I was thinking about using the Rules module, but I am not sure how it can handle this. Does performance suffer, if there are ten of thousands or even more users?
The Userpoints module will be used.