qalam_merit 4.5.05 → 4.5.06

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: 36dd98bb62a667ae5b42ca9edb1a6aa9d547a139d268f9da523476937d61d077
4
- data.tar.gz: 3d36fe5887fc5844b4e13f342e73216d7fc8ab1f6d70e1a458437c9b86fd247e
3
+ metadata.gz: d32a4d56924a23f24741b8aa276cd54f32767ad51d8c04df8d138f4c82d2c427
4
+ data.tar.gz: 5202cdc4c9c90323f07dffe90eb1db4a6690df92dce156fb7466f30526482bf5
5
5
  SHA512:
6
- metadata.gz: b797616130749f3f74ad7b2737dc32461866896547f32f9039d56474f309d20a07113a42f0fa3dd0af105450b511455ff4b769a517d5656885cdfc56194c6780
7
- data.tar.gz: 26bc8ce7e1adcee901aaa6f929a0e89d73d22b7088c30cc5321c1369ca4528593417a48336ff6e31b5c03d94505adc6df3701a92bd9f825e1828db0da6d3638b
6
+ metadata.gz: 3a64775d9aa10271625631b8bbad64482a3fc09c1776652a7fba52bdafb3a78da0a87ea5c1a7b3fd6d8f4c20dace827087c2c4790578fcd4eeb1d2634608e031
7
+ data.tar.gz: 73a2d727db358c669dccdf8e9f73212410c563ce50262e20052ab6b8cd73111f932cfb09aa1ae8fdc00edeaa68018278d0a99baaf9421d62492b5a8fa26679f4
@@ -16,7 +16,7 @@ module Merit
16
16
 
17
17
  # Delegate methods from meritable models to their sash
18
18
  def _merit_delegate_methods_to_sash
19
- methods = %w(badge_ids badges points add_badge rm_badge
19
+ methods = %w(badge_ids badges points add_badge add_qalam_badge rm_badge
20
20
  add_points subtract_points score_points)
21
21
  methods.each { |method| delegate method, to: :_sash }
22
22
  end
@@ -6,6 +6,7 @@ module Merit::Models::ActiveRecord
6
6
  has_many :activity_logs,
7
7
  class_name: 'Merit::ActivityLog',
8
8
  as: :related_change
9
+ belongs_to :course, foreign_key: "course_id", class_name: 'Course'
9
10
 
10
11
  validates_presence_of :badge_id, :sash
11
12
  end
@@ -8,16 +8,27 @@ module Merit::Models
8
8
  badges_sashes.map(&:badge_id)
9
9
  end
10
10
 
11
- def add_badge(badge_id)
12
- bs = Merit::BadgesSash.new(badge_id: badge_id.to_i)
13
- badges_sashes << bs
14
- bs
11
+ def add_badge(badge_id, options = {})
12
+ if (course_id = options[:course_id])
13
+ bs = Merit::BadgesSash.new(badge_id: badge_id.to_i, course_id: course_id.to_i)
14
+ else
15
+ bs = Merit::BadgesSash.new(badge_id: badge_id.to_i)
16
+ end
17
+ badges_sashes << bs
18
+ bs
15
19
  end
16
20
 
17
21
  def rm_badge(badge_id)
18
22
  badges_sashes.where(badge_id: badge_id.to_i).first.try(:destroy)
19
23
  end
20
24
 
25
+ ########################QALAM_DEV#########################
26
+ def add_qalam_badge(badge_id, course_id)
27
+ bs = Merit::BadgesSash.new(badge_id: badge_id.to_i, course_id: course_id.to_i)
28
+ badges_sashes << bs
29
+ bs
30
+ end
31
+ ########################END###################################
21
32
  # Retrieve the number of points from a category
22
33
  # By default all points are summed up
23
34
  # @param category [String] The category
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.05'
9
+ s.version = '4.5.06'
10
10
  s.authors = ["Tute Costa", "Ahmed Abdelhamid"]
11
11
  s.email = ['tutecosta@gmail.com', 'a.hamid@nezam.io']
12
12
 
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.05
4
+ version: 4.5.06
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tute Costa