Commit a1febfd2fd755fc77d903f3279481a2e87cdee43
1 parent
a756ab10
Exists in
master
and in
1 other branch
Remove unsed code from point_rules
Showing
1 changed file
with
4 additions
and
5 deletions
Show diff stats
lib/merit/point_rules.rb
| ... | ... | @@ -61,7 +61,6 @@ module Merit |
| 61 | 61 | action: 'vote#create', |
| 62 | 62 | undo_action: 'vote#destroy', |
| 63 | 63 | to: lambda {|vote| vote.voteable.author}, |
| 64 | - profile: lambda {|vote| vote.voteable.profile}, | |
| 65 | 64 | value: lambda {|vote| vote.vote}, |
| 66 | 65 | description: _('Author of a voted content'), |
| 67 | 66 | default_weight: 20, |
| ... | ... | @@ -71,7 +70,6 @@ module Merit |
| 71 | 70 | action: 'vote#create', |
| 72 | 71 | undo_action: 'vote#destroy', |
| 73 | 72 | to: lambda {|vote| vote.voteable}, |
| 74 | - profile: lambda {|vote| vote.voteable.profile}, | |
| 75 | 73 | value: lambda {|vote| vote.vote}, |
| 76 | 74 | description: _('Voted content'), |
| 77 | 75 | default_weight: 30, |
| ... | ... | @@ -101,7 +99,6 @@ module Merit |
| 101 | 99 | value: 1, |
| 102 | 100 | description: _('Profile Completion'), |
| 103 | 101 | default_weight: 100, |
| 104 | - model_name: "User", | |
| 105 | 102 | condition: lambda {|person, profile| person.person? and person.profile_completion_score_condition }, |
| 106 | 103 | }, |
| 107 | 104 | follower: { |
| ... | ... | @@ -159,8 +156,10 @@ module Merit |
| 159 | 156 | [setting[:action], setting[:undo_action]].compact.zip([1, -1]).each do |action, signal| |
| 160 | 157 | options = {on: action, to: setting[:to], category: categorization.id.to_s} |
| 161 | 158 | options[:model_name] = setting[:model] unless setting[:model].nil? |
| 162 | - score lambda {|target| signal * calculate_score(target, categorization.weight, setting[:value])}, options do |target| | |
| 163 | - condition(setting, target, categorization.profile) | |
| 159 | + weight = categorization.weight | |
| 160 | + profile = categorization.profile | |
| 161 | + score lambda {|target| signal * calculate_score(target, weight, setting[:value])}, options do |target| | |
| 162 | + condition(setting, target, profile) | |
| 164 | 163 | end |
| 165 | 164 | end |
| 166 | 165 | end | ... | ... |