I want to try and design a reward system on a new website I am building. For example (for illustrative purposes only):
Stack overflow's medals system is another example.
My question is, you can store the description and name of each badge easily in a database table.
**tbl_Badges**
ID | Badge Name | canHaveMultiple | hasProgress | progressScale
----------------------------------------------------------------------------
1 Copy Editor Yes No null
2 The Mob Yes No null
3 Jquery No Yes 100
And then to associate users with these badges:
**tbl_UsersBadges**
ID | Badge ID | User ID
---------------------------
1 1 5
2 1 5
3 2 5
4 2 12
(And perhaps another one to store user progress through scale badges etc etc)
But the difficulty comes in programming the triggers that award these badges.
Are systems like this built with hard coded triggers in the website? This is about the only way I can think of doing it due to the broadness and flexibility of these badges. However if the triggers are hard coded to a badge ID, you are going to have to be extremely careful when changing anything.
So is this how such a system works? It goes against what I have learnt. Or am I approaching the problem wrongly?
First you need to make sure you have a clear list of "rewarded" user actions. Then, you have to create some code which will be triggered when one of those actions happen. There are multiple ways of looking at the solution: