Commit 624926b0d2789cde06c035dc1356861ae2cd9382
1 parent
9cb5a092
Exists in
master
and in
1 other branch
Set default point weights
Showing
3 changed files
with
11 additions
and
11 deletions
Show diff stats
lib/merit/point_rules.rb
@@ -9,7 +9,7 @@ module Merit | @@ -9,7 +9,7 @@ module Merit | ||
9 | :to => :author, | 9 | :to => :author, |
10 | :value => 1, | 10 | :value => 1, |
11 | :description => _('Point weight for comment author'), | 11 | :description => _('Point weight for comment author'), |
12 | - :default_weight => 10 | 12 | + :default_weight => 150 |
13 | }, | 13 | }, |
14 | :comment_article_author => { | 14 | :comment_article_author => { |
15 | :action => 'comment#create', | 15 | :action => 'comment#create', |
@@ -17,7 +17,7 @@ module Merit | @@ -17,7 +17,7 @@ module Merit | ||
17 | :to => lambda {|comment| comment.source.author}, | 17 | :to => lambda {|comment| comment.source.author}, |
18 | :value => 1, | 18 | :value => 1, |
19 | :description => _('Point weight for article author of a comment'), | 19 | :description => _('Point weight for article author of a comment'), |
20 | - :default_weight => 10 | 20 | + :default_weight => 50 |
21 | }, | 21 | }, |
22 | :article_author => { | 22 | :article_author => { |
23 | :action => 'article#create', | 23 | :action => 'article#create', |
@@ -33,7 +33,7 @@ module Merit | @@ -33,7 +33,7 @@ module Merit | ||
33 | :to => :profile, | 33 | :to => :profile, |
34 | :value => 1, | 34 | :value => 1, |
35 | :description => _('Point weight for article community'), | 35 | :description => _('Point weight for article community'), |
36 | - :default_weight => 500, | 36 | + :default_weight => 600, |
37 | :condition => lambda {|target| target.profile.community? } | 37 | :condition => lambda {|target| target.profile.community? } |
38 | }, | 38 | }, |
39 | :vote_voteable_author => { | 39 | :vote_voteable_author => { |
@@ -43,7 +43,7 @@ module Merit | @@ -43,7 +43,7 @@ module Merit | ||
43 | :profile => lambda {|vote| vote.voteable.profile}, | 43 | :profile => lambda {|vote| vote.voteable.profile}, |
44 | :value => lambda {|vote| vote.vote}, | 44 | :value => lambda {|vote| vote.vote}, |
45 | :description => _('Point weight for the author of a voted content'), | 45 | :description => _('Point weight for the author of a voted content'), |
46 | - :default_weight => 5 | 46 | + :default_weight => 50 |
47 | }, | 47 | }, |
48 | :vote_voteable => { | 48 | :vote_voteable => { |
49 | :action => 'vote#create', | 49 | :action => 'vote#create', |
@@ -52,7 +52,7 @@ module Merit | @@ -52,7 +52,7 @@ module Merit | ||
52 | :profile => lambda {|vote| vote.voteable.profile}, | 52 | :profile => lambda {|vote| vote.voteable.profile}, |
53 | :value => lambda {|vote| vote.vote}, | 53 | :value => lambda {|vote| vote.vote}, |
54 | :description => _('Point weight for a voted content'), | 54 | :description => _('Point weight for a voted content'), |
55 | - :default_weight => 5 | 55 | + :default_weight => 50 |
56 | }, | 56 | }, |
57 | # TODO comment_voter and article_voter | 57 | # TODO comment_voter and article_voter |
58 | } | 58 | } |
test/unit/article_test.rb
@@ -45,7 +45,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -45,7 +45,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
45 | should 'add merit points to article owner when an user like it' do | 45 | should 'add merit points to article owner when an user like it' do |
46 | article = create(Article, :name => 'Test', :profile => person, :author => person) | 46 | article = create(Article, :name => 'Test', :profile => person, :author => person) |
47 | 47 | ||
48 | - assert_difference 'article.author.points(:category => :vote_voteable_author)', 5 do | 48 | + assert_difference 'article.author.points(:category => :vote_voteable_author)', 50 do |
49 | Vote.create!(:voter => person, :voteable => article, :vote => 1) | 49 | Vote.create!(:voter => person, :voteable => article, :vote => 1) |
50 | end | 50 | end |
51 | end | 51 | end |
@@ -54,7 +54,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -54,7 +54,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
54 | article = create(Article, :name => 'Test', :profile => person, :author => person) | 54 | article = create(Article, :name => 'Test', :profile => person, :author => person) |
55 | article = article.reload | 55 | article = article.reload |
56 | 56 | ||
57 | - assert_difference 'article.points(:category => :vote_voteable)', 5 do | 57 | + assert_difference 'article.points(:category => :vote_voteable)', 50 do |
58 | Vote.create!(:voter => person, :voteable => article, :vote => 1) | 58 | Vote.create!(:voter => person, :voteable => article, :vote => 1) |
59 | end | 59 | end |
60 | end | 60 | end |
test/unit/comment_test.rb
@@ -46,7 +46,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -46,7 +46,7 @@ class CommentTest < ActiveSupport::TestCase | ||
46 | should 'add merit points to comment owner when an user like his comment' do | 46 | should 'add merit points to comment owner when an user like his comment' do |
47 | comment = create(Comment, :source => article, :author_id => person.id) | 47 | comment = create(Comment, :source => article, :author_id => person.id) |
48 | 48 | ||
49 | - assert_difference 'comment.author.points(:category => :vote_voteable_author)', 5 do | 49 | + assert_difference 'comment.author.points(:category => :vote_voteable_author)', 50 do |
50 | Vote.create!(:voter => person, :voteable => comment, :vote => 1) | 50 | Vote.create!(:voter => person, :voteable => comment, :vote => 1) |
51 | end | 51 | end |
52 | end | 52 | end |
@@ -55,7 +55,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -55,7 +55,7 @@ class CommentTest < ActiveSupport::TestCase | ||
55 | comment = create(Comment, :source => article, :author_id => person.id) | 55 | comment = create(Comment, :source => article, :author_id => person.id) |
56 | Vote.create!(:voter => person, :voteable => comment, :vote => 1) | 56 | Vote.create!(:voter => person, :voteable => comment, :vote => 1) |
57 | 57 | ||
58 | - assert_difference 'comment.author.points', -5 do | 58 | + assert_difference 'comment.author.points', -50 do |
59 | Vote.where(:voteable_id => comment.id).destroy_all | 59 | Vote.where(:voteable_id => comment.id).destroy_all |
60 | end | 60 | end |
61 | end | 61 | end |
@@ -63,7 +63,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -63,7 +63,7 @@ class CommentTest < ActiveSupport::TestCase | ||
63 | should 'subtract merit points from comment owner when an user dislike his comment' do | 63 | should 'subtract merit points from comment owner when an user dislike his comment' do |
64 | comment = create(Comment, :source => article, :author_id => person.id) | 64 | comment = create(Comment, :source => article, :author_id => person.id) |
65 | 65 | ||
66 | - assert_difference 'comment.author.points(:category => :vote_voteable_author)', -5 do | 66 | + assert_difference 'comment.author.points(:category => :vote_voteable_author)', -50 do |
67 | Vote.create!(:voter => person, :voteable => comment, :vote => -1) | 67 | Vote.create!(:voter => person, :voteable => comment, :vote => -1) |
68 | end | 68 | end |
69 | end | 69 | end |
@@ -72,7 +72,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -72,7 +72,7 @@ class CommentTest < ActiveSupport::TestCase | ||
72 | comment = create(Comment, :source => article, :author_id => person.id) | 72 | comment = create(Comment, :source => article, :author_id => person.id) |
73 | Vote.create!(:voter => person, :voteable => comment, :vote => -1) | 73 | Vote.create!(:voter => person, :voteable => comment, :vote => -1) |
74 | 74 | ||
75 | - assert_difference 'comment.author.points', 5 do | 75 | + assert_difference 'comment.author.points', 50 do |
76 | Vote.where(:voteable_id => comment.id).destroy_all | 76 | Vote.where(:voteable_id => comment.id).destroy_all |
77 | end | 77 | end |
78 | end | 78 | end |