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,7 +61,6 @@ module Merit | ||
61 | action: 'vote#create', | 61 | action: 'vote#create', |
62 | undo_action: 'vote#destroy', | 62 | undo_action: 'vote#destroy', |
63 | to: lambda {|vote| vote.voteable.author}, | 63 | to: lambda {|vote| vote.voteable.author}, |
64 | - profile: lambda {|vote| vote.voteable.profile}, | ||
65 | value: lambda {|vote| vote.vote}, | 64 | value: lambda {|vote| vote.vote}, |
66 | description: _('Author of a voted content'), | 65 | description: _('Author of a voted content'), |
67 | default_weight: 20, | 66 | default_weight: 20, |
@@ -71,7 +70,6 @@ module Merit | @@ -71,7 +70,6 @@ module Merit | ||
71 | action: 'vote#create', | 70 | action: 'vote#create', |
72 | undo_action: 'vote#destroy', | 71 | undo_action: 'vote#destroy', |
73 | to: lambda {|vote| vote.voteable}, | 72 | to: lambda {|vote| vote.voteable}, |
74 | - profile: lambda {|vote| vote.voteable.profile}, | ||
75 | value: lambda {|vote| vote.vote}, | 73 | value: lambda {|vote| vote.vote}, |
76 | description: _('Voted content'), | 74 | description: _('Voted content'), |
77 | default_weight: 30, | 75 | default_weight: 30, |
@@ -101,7 +99,6 @@ module Merit | @@ -101,7 +99,6 @@ module Merit | ||
101 | value: 1, | 99 | value: 1, |
102 | description: _('Profile Completion'), | 100 | description: _('Profile Completion'), |
103 | default_weight: 100, | 101 | default_weight: 100, |
104 | - model_name: "User", | ||
105 | condition: lambda {|person, profile| person.person? and person.profile_completion_score_condition }, | 102 | condition: lambda {|person, profile| person.person? and person.profile_completion_score_condition }, |
106 | }, | 103 | }, |
107 | follower: { | 104 | follower: { |
@@ -159,8 +156,10 @@ module Merit | @@ -159,8 +156,10 @@ module Merit | ||
159 | [setting[:action], setting[:undo_action]].compact.zip([1, -1]).each do |action, signal| | 156 | [setting[:action], setting[:undo_action]].compact.zip([1, -1]).each do |action, signal| |
160 | options = {on: action, to: setting[:to], category: categorization.id.to_s} | 157 | options = {on: action, to: setting[:to], category: categorization.id.to_s} |
161 | options[:model_name] = setting[:model] unless setting[:model].nil? | 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 | end | 163 | end |
165 | end | 164 | end |
166 | end | 165 | end |