Commit 880488dc501fd8da1bcb2bc0aedf190accc627e8
1 parent
7ab9ee86
Exists in
master
and in
1 other branch
Fix search for the score point category
Showing
2 changed files
with
10 additions
and
1 deletions
Show diff stats
lib/gamification_plugin/dashboard_helper.rb
@@ -12,7 +12,7 @@ module GamificationPlugin::DashboardHelper | @@ -12,7 +12,7 @@ module GamificationPlugin::DashboardHelper | ||
12 | end | 12 | end |
13 | 13 | ||
14 | def score_point_category(point) | 14 | def score_point_category(point) |
15 | - point = GamificationPlugin::PointsType.where(name: point.score.category).first | 15 | + point = GamificationPlugin::PointsType.where(id: point.score.category).first |
16 | point.nil? ? '' : point.description | 16 | point.nil? ? '' : point.description |
17 | end | 17 | end |
18 | 18 |
test/unit/dashboard_helper_test.rb
@@ -22,4 +22,13 @@ class DashboardHelperTest < ActiveSupport::TestCase | @@ -22,4 +22,13 @@ class DashboardHelperTest < ActiveSupport::TestCase | ||
22 | assert_equal [[badge2.owner, [badge2]], [badge1.owner, [badge1]]], grouped_badges | 22 | assert_equal [[badge2.owner, [badge2]], [badge1.owner, [badge1]]], grouped_badges |
23 | end | 23 | end |
24 | 24 | ||
25 | + should 'return category of a score point' do | ||
26 | + point_type = GamificationPlugin::PointsType.create!(name: "point category", description: "point category") | ||
27 | + score = Merit::Score.new | ||
28 | + score.category = point_type.id.to_s | ||
29 | + score.save! | ||
30 | + point = score.score_points.create! | ||
31 | + assert_equal "point category", score_point_category(point) | ||
32 | + end | ||
33 | + | ||
25 | end | 34 | end |