| 1 | # Be sure to restart your server when you modify this file. |
| 2 | # |
| 3 | # 5 stars is a common ranking use case. They are not given at specified |
| 4 | # actions like badges, you should define a cron job to test if ranks are to be |
| 5 | # granted. |
| 6 | # |
| 7 | # +set_rank+ accepts: |
| 8 | # * :+level+ ranking level (greater is better) |
| 9 | # * :+to+ model or scope to check if new rankings apply |
| 10 | # * :+level_name+ attribute name (default is empty and results in 'level' |
| 11 | # attribute, if set it's appended like 'level_#{level_name}') |
| 12 | |
| 13 | module Merit |
| 14 | class RankRules |
| 15 | include Merit::RankRulesMethods |
| 16 | |
| 17 | def initialize |
| 18 | # set_rank :level => 1, :to => Commiter.active do |commiter| |
| 19 | # commiter.repositories.count > 1 && commiter.followers >= 10 |
| 20 | # end |
| 21 | # |
| 22 | # set_rank :level => 2, :to => Commiter.active do |commiter| |
| 23 | # commiter.branches.count > 1 && commiter.followers >= 10 |
| 24 | # end |
| 25 | # |
| 26 | # set_rank :level => 3, :to => Commiter.active do |commiter| |
| 27 | # commiter.branches.count > 2 && commiter.followers >= 20 |
| 28 | # end |
| 29 | end |
| 30 | end |
| 31 | end |