qalam_merit 4.5.00 → 4.5.01

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ab565f1556eaadc0a27bae07268086f9fa1b12eb22a3d4c632e6012007273be
4
- data.tar.gz: b552bf47e0e58f023d1ff914ab8510fd8096667b7642715da40c57c88830048e
3
+ metadata.gz: a062b61ba12835e8cc9ea7eeed4eb6b94eccaa7fdd4323cdc8efd226e5331aa7
4
+ data.tar.gz: b91428baa833ca06913fe27c2c54623db498e5a0a051c368fc3b3cb509e18971
5
5
  SHA512:
6
- metadata.gz: 36ba58be649f037433f84febc55d172cecbc5ac9eb86a829105c5314f74891c4205f79d876710a62ffe0a9f8f9e0c49b296a1b9fb72371845ffcf778b4d1b850
7
- data.tar.gz: 9a4367ae89c7680fbe09dfef4255e2a0abc50e19dae684980458fa715829d5e58a46bb2e2689df7300f6a01960fd6fbd9689aac0db80884cee685aceead4f8c7
6
+ metadata.gz: 2a3e6f2eceff7d5971e4e8ebfc71a71d7cc553e76ca7bb07c5c51e071bbeeefe782fe7d6be7c27ccab85fb514a7de83a2cf1246bd081246d6ddda5c79ab0e79a
7
+ data.tar.gz: dff4b30e28a4f91bbc49f661fbc55aee612ab8ae849e429f545089690b582e533c993b39f3b01ef0f9a2d41283c290660007ffb383feb0f94f1d39f62b52377b
@@ -9,7 +9,7 @@ module Merit
9
9
  if model_exists?
10
10
  inject_into_class(model_path, class_name, " ### END ###\n\n")
11
11
  inject_into_class(model_path, class_name, " has_many :created_badges, class_name: 'Merit::Badge'\n")
12
- inject_into_class(model_path, class_name, " belongs_to :sash, foreign_key: 'sash_id', class_name: 'Merit::QalamSash'\n")
12
+ inject_into_class(model_path, class_name, " belongs_to :sash, foreign_key: 'sash_id', class_name: 'Merit::Sash'\n")
13
13
  inject_into_class(model_path, class_name, " has_merit\n")
14
14
  inject_into_class(model_path, class_name, " ### QALAM_MERIT ###\n")
15
15
  end
@@ -1,10 +1,10 @@
1
1
  module Merit::Models::ActiveRecord
2
- class Score < ActiveRecord::Base
2
+ class MeritScore < ActiveRecord::Base
3
3
  self.table_name = :merit_scores
4
4
  belongs_to :sash
5
5
  has_many :score_points,
6
6
  dependent: :destroy,
7
- class_name: 'Merit::Score::Point'
7
+ class_name: 'Merit::MeritScore::Point'
8
8
 
9
9
  def points
10
10
  score_points.group(:score_id).sum(:num_points).values.first || 0
@@ -21,5 +21,5 @@ module Merit::Models::ActiveRecord
21
21
  end
22
22
  end
23
23
 
24
- class Merit::Score < Merit::Models::ActiveRecord::Score; end
25
- class Merit::Score::Point < Merit::Models::ActiveRecord::Score::Point; end
24
+ class Merit::MeritScore < Merit::Models::ActiveRecord::Score; end
25
+ class Merit::MeritScore::Point < Merit::Models::ActiveRecord::Score::Point; end
@@ -11,7 +11,7 @@ module Merit::Models::ActiveRecord
11
11
 
12
12
  has_many :badges_sashes, dependent: :destroy
13
13
  has_many :badges, through: :badges_sashes, source: :badge
14
- has_many :scores, dependent: :destroy, class_name: 'Merit::Score'
14
+ has_many :scores, dependent: :destroy, class_name: 'Merit::MeritScore'
15
15
 
16
16
  after_create :create_scores
17
17
 
@@ -20,7 +20,7 @@ module Merit::Models::ActiveRecord
20
20
  # @param category [String] The category
21
21
  # @return [ActiveRecord::Relation] containing the points
22
22
  def score_points(options = {})
23
- scope = Merit::Score::Point
23
+ scope = Merit::MeritScore::Point
24
24
  .joins(:score)
25
25
  .where('merit_scores.sash_id = ?', id)
26
26
  if (category = options[:category])
@@ -32,7 +32,7 @@ module Merit
32
32
  end
33
33
 
34
34
  def add_points(num_points, options = {})
35
- point = Merit::Score::Point.new
35
+ point = Merit::MeritScore::Point.new
36
36
  point.num_points = num_points
37
37
  scores
38
38
  .where(category: options[:category] || 'default')
@@ -48,7 +48,7 @@ module Merit
48
48
  private
49
49
 
50
50
  def create_scores
51
- scores << Merit::Score.create
51
+ scores << Merit::MeritScore.create
52
52
  end
53
53
  end
54
54
  end
@@ -31,7 +31,7 @@ module Merit::Models
31
31
  end
32
32
 
33
33
  def add_points(num_points, options = {})
34
- point = Merit::Score::Point.new
34
+ point = Merit::MeritScore::Point.new
35
35
  point.num_points = num_points
36
36
  scores
37
37
  .where(category: options[:category] || 'default')
@@ -47,7 +47,7 @@ module Merit::Models
47
47
  private
48
48
 
49
49
  def create_scores
50
- scores << Merit::Score.create
50
+ scores << Merit::MeritScore.create
51
51
  end
52
52
  end
53
53
  end
data/qalam_merit.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.files = `git ls-files`.split("\n").reject{|f| f =~ /^\./ }
7
7
  s.test_files = `git ls-files -- test/*`.split("\n")
8
8
  s.license = 'MIT'
9
- s.version = '4.5.00'
9
+ s.version = '4.5.01'
10
10
  s.authors = ["Tute Costa", "Ahmed Abdelhamid"]
11
11
  s.email = ['tutecosta@gmail.com', 'a.hamid@nezam.io']
12
12
 
@@ -107,12 +107,12 @@ class NavigationTest < ActionDispatch::IntegrationTest
107
107
  assert user.badges.empty?, 'Should not have badges'
108
108
 
109
109
  assert_equal 0, user.points
110
- assert_equal 0, Merit::Score::Point.count
110
+ assert_equal 0, Merit::MeritScore::Point.count
111
111
  user.add_points 15
112
112
  assert_equal 15, user.points
113
113
  user.subtract_points 15
114
114
  assert_equal 0, user.points
115
- assert_equal 2, Merit::Score::Point.count
115
+ assert_equal 2, Merit::MeritScore::Point.count
116
116
 
117
117
  # Tenth comment with errors doesn't change reputation
118
118
  badges = user.reload.badges
@@ -2,10 +2,10 @@ require 'test_helper'
2
2
 
3
3
  describe Merit::Score do
4
4
  it 'Point#sash_id delegates to Score' do
5
- score = Merit::Score.new
5
+ score = Merit::MeritScore.new
6
6
  score.sash_id = 33
7
7
 
8
- point = Merit::Score::Point.new
8
+ point = Merit::MeritScore::Point.new
9
9
  point.score = score
10
10
 
11
11
  _(point.sash_id).must_be :==, score.sash_id
@@ -10,7 +10,7 @@ class SashTest < ActiveSupport::TestCase
10
10
  describe "when category specified" do
11
11
  it "should create a new Point with specified category" do
12
12
  @sash.add_points 5, category: @custom_category
13
- score = Merit::Score.last
13
+ score = Merit::MeritScore.last
14
14
  point = score.score_points.last
15
15
 
16
16
  assert_equal point.num_points, 5
@@ -19,10 +19,10 @@ class SashTest < ActiveSupport::TestCase
19
19
  end
20
20
 
21
21
  it "should create a new Point in category default with specified number of points" do
22
- assert_difference("Merit::Score::Point.count", 1) do
22
+ assert_difference("Merit::MeritScore::Point.count", 1) do
23
23
  @sash.add_points 5
24
24
  end
25
- score = Merit::Score.last
25
+ score = Merit::MeritScore.last
26
26
  point = score.score_points.last
27
27
 
28
28
  assert_equal point.num_points, 5
@@ -34,7 +34,7 @@ class SashTest < ActiveSupport::TestCase
34
34
  describe "when category specified" do
35
35
  it "should create a new Point with specified category" do
36
36
  @sash.subtract_points 5, category: @custom_category
37
- score = Merit::Score.last
37
+ score = Merit::MeritScore.last
38
38
  point = score.score_points.last
39
39
 
40
40
  assert_equal point.num_points, -5
@@ -43,10 +43,10 @@ class SashTest < ActiveSupport::TestCase
43
43
  end
44
44
 
45
45
  it "should create a new Point in category default with inverse of specified number of points" do
46
- assert_difference("Merit::Score::Point.count", 1) do
46
+ assert_difference("Merit::MeritScore::Point.count", 1) do
47
47
  @sash.subtract_points 5
48
48
  end
49
- score = Merit::Score.last
49
+ score = Merit::MeritScore.last
50
50
  point = score.score_points.last
51
51
 
52
52
  assert_equal point.num_points, -5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qalam_merit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.00
4
+ version: 4.5.01
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tute Costa
@@ -158,8 +158,8 @@ files:
158
158
  - lib/merit/models/active_record/action.rb
159
159
  - lib/merit/models/active_record/activity_log.rb
160
160
  - lib/merit/models/active_record/badges_sash.rb
161
+ - lib/merit/models/active_record/merit_score.rb
161
162
  - lib/merit/models/active_record/sash.rb
162
- - lib/merit/models/active_record/score.rb
163
163
  - lib/merit/models/badges_sash_concern.rb
164
164
  - lib/merit/models/base/badges_sash.rb
165
165
  - lib/merit/models/base/sash.rb
@@ -246,12 +246,12 @@ files:
246
246
  - test/test_helper.rb
247
247
  - test/unit/action_test.rb
248
248
  - test/unit/base_target_finder_test.rb
249
+ - test/unit/merit_score_test.rb
249
250
  - test/unit/merit_unit_test.rb
250
251
  - test/unit/rule_unit_test.rb
251
252
  - test/unit/rules_matcher_test.rb
252
253
  - test/unit/sash_finder_test.rb
253
254
  - test/unit/sash_test.rb
254
- - test/unit/score_test.rb
255
255
  - test/unit/target_finder_test.rb
256
256
  homepage: https://github.com/merit-gem/merit
257
257
  licenses:
@@ -351,10 +351,10 @@ test_files:
351
351
  - test/test_helper.rb
352
352
  - test/unit/action_test.rb
353
353
  - test/unit/base_target_finder_test.rb
354
+ - test/unit/merit_score_test.rb
354
355
  - test/unit/merit_unit_test.rb
355
356
  - test/unit/rule_unit_test.rb
356
357
  - test/unit/rules_matcher_test.rb
357
358
  - test/unit/sash_finder_test.rb
358
359
  - test/unit/sash_test.rb
359
- - test/unit/score_test.rb
360
360
  - test/unit/target_finder_test.rb