Commit 4fb15ec20f7464190f936b86662e6f7fffe10c68
Exists in
master
and in
1 other branch
Merge branch 'master' of gitlab.com:noosfero-plugins/gamification
Showing
4 changed files
with
28 additions
and
3 deletions
Show diff stats
Gemfile
lib/merit/point_rules.rb
... | ... | @@ -61,7 +61,6 @@ module Merit |
61 | 61 | :value => lambda {|vote| vote.vote}, |
62 | 62 | :description => _('Point weight for the author of a voted content'), |
63 | 63 | :default_weight => 50, |
64 | - :condition => lambda {|vote| vote.voteable.profile.community? } | |
65 | 64 | }, |
66 | 65 | :vote_voteable => { |
67 | 66 | :action => 'vote#create', | ... | ... |
... | ... | @@ -0,0 +1,25 @@ |
1 | +def create_action(obj) | |
2 | + target_model = obj.class.base_class.name.downcase | |
3 | + action = Merit::Action.find_by_target_id_and_target_model_and_action_method(obj.id, target_model, 'create') | |
4 | + if action.nil? | |
5 | + puts "Create merit action for #{target_model} #{obj.id}" | |
6 | + obj.new_merit_action(:create) | |
7 | + end | |
8 | +end | |
9 | + | |
10 | +Environment.all.each do |environment| | |
11 | + | |
12 | + Merit::AppPointRules.clear | |
13 | + Merit::AppBadgeRules.clear | |
14 | + Merit::AppPointRules.merge!(Merit::PointRules.new(environment).defined_rules) | |
15 | + Merit::AppBadgeRules.merge!(Merit::BadgeRules.new(environment).defined_rules) | |
16 | + | |
17 | + environment.articles.each do |article| | |
18 | + create_action(article) | |
19 | + | |
20 | + article.comments.each do |comment| | |
21 | + create_action(comment) | |
22 | + end | |
23 | + end | |
24 | + | |
25 | +end | ... | ... |
test/functional/gamification_plugin_profile_controller_test.rb
... | ... | @@ -14,8 +14,8 @@ class GamificationPluginProfileControllerTest < ActionController::TestCase |
14 | 14 | person.add_points(20, :category => :comment_author) |
15 | 15 | person.add_points(30, :category => :article_author) |
16 | 16 | get :dashboard, :profile => person.identifier |
17 | - assert_tag :div, :attributes => {:class => 'score article_author'}, :child => {:tag => 'span', :attributes => {:class => 'value'}, :content => '30'} | |
18 | - assert_tag :div, :attributes => {:class => 'score comment_author'}, :child => {:tag => 'span', :attributes => {:class => 'value'}, :content => '20'} | |
17 | + assert_tag :div, :attributes => {:class => 'score article_author'}, :child => {:tag => 'span', :attributes => {:class => 'value positive'}, :content => '30'} | |
18 | + assert_tag :div, :attributes => {:class => 'score comment_author'}, :child => {:tag => 'span', :attributes => {:class => 'value positive'}, :content => '20'} | |
19 | 19 | assert_tag :div, :attributes => {:class => 'score total'}, :child => {:tag => 'span', :attributes => {:class => 'value'}, :content => '50'} |
20 | 20 | end |
21 | 21 | ... | ... |