qalam_merit 4.5.08 → 4.5.09
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/merit/class_methods.rb +1 -1
- data/lib/merit/generators/templates/badge.erb +8 -3
- data/lib/merit/models/sash_concern.rb +4 -10
- data/qalam_merit.gemspec +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54fd36c8d0594e5288774e2caf5b4bca4b642e63fefd50d564b80ce5abdbaae0
|
4
|
+
data.tar.gz: 7bf97cb6b288354c70bf82f2573d37db6b363230309243848ed7335240282e30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ecdd00a696088ac97a9ed78671f3c3f8a98da81a89d1d722306c4b6c46cd86f3cc8c9262eb09408afaee973a62891ead6f2260b0b2de775c3eacef09c8ea3f8
|
7
|
+
data.tar.gz: f04638fd6694a4f0af6aae82d5db77b30263d494f3267530247b161a31f07454275cf6abfa994b783c40ee58370cb0b7f90a691ee4f61981168ae9af937b0b85
|
data/lib/merit/class_methods.rb
CHANGED
@@ -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
|
19
|
+
methods = %w(badge_ids badges points add_badge rm_badge
|
20
20
|
add_points subtract_points score_points)
|
21
21
|
methods.each { |method| delegate method, to: :_sash }
|
22
22
|
end
|
@@ -11,9 +11,9 @@ class Merit::Badge < ActiveRecord::Base
|
|
11
11
|
self.description = self.description.strip unless self.description.nil?
|
12
12
|
end
|
13
13
|
|
14
|
-
validates :name, presence: true, length: { minimum:
|
14
|
+
validates :name, presence: true, length: { minimum: 1, maximum: 20 }
|
15
15
|
validates :points, presence: true, numericality: true, :inclusion => 1..100
|
16
|
-
validates :description, presence: true, length: { minimum: 3, maximum:
|
16
|
+
validates :description, presence: true, length: { minimum: 3, maximum: 100 }
|
17
17
|
|
18
18
|
has_one :image, :class_name => 'Attachment', :as => :context, :inverse_of => :context, :dependent => :destroy
|
19
19
|
belongs_to :created_by, foreign_key: "user_id", class_name: 'User'
|
@@ -66,7 +66,12 @@ class Merit::Badge < ActiveRecord::Base
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def create_with_attachment(account, badge, attachment)
|
69
|
-
|
69
|
+
if ((attachment.nil? || attachment.to_s == "null") || account.nil? || badge.nil?)
|
70
|
+
badge.errors.add(:image, :image_required, message: 'Image Required')
|
71
|
+
badge.destroy if badge.id
|
72
|
+
return false
|
73
|
+
end
|
74
|
+
|
70
75
|
if attachment.content_type && @valid_images.include?(attachment.content_type)
|
71
76
|
account.shard.activate do
|
72
77
|
att = Attachment.create_data_attachment(badge, attachment)
|
@@ -26,13 +26,6 @@ module Merit::Models
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
########################QALAM_DEV#########################
|
30
|
-
def add_qalam_badge(badge_id, course_id)
|
31
|
-
bs = Merit::BadgesSash.new(badge_id: badge_id.to_i, course_id: course_id.to_i)
|
32
|
-
badges_sashes << bs
|
33
|
-
bs
|
34
|
-
end
|
35
|
-
########################END###################################
|
36
29
|
# Retrieve the number of points from a category
|
37
30
|
# By default all points are summed up
|
38
31
|
# @param category [String] The category
|
@@ -48,10 +41,11 @@ module Merit::Models
|
|
48
41
|
def add_points(num_points, options = {})
|
49
42
|
point = Merit::QalamScore::Point.new
|
50
43
|
point.num_points = num_points
|
44
|
+
point.course_id = options[:course_id].to_i
|
51
45
|
scores
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
.where(category: options[:category] || 'default')
|
47
|
+
.first_or_create
|
48
|
+
.score_points << point
|
55
49
|
point
|
56
50
|
end
|
57
51
|
|
data/qalam_merit.gemspec
CHANGED
@@ -6,9 +6,9 @@ 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.
|
10
|
-
s.authors = ["
|
11
|
-
s.email = ['
|
9
|
+
s.version = '4.5.09'
|
10
|
+
s.authors = ["Ahmed Abdelhamid", "Zeyad Saleh"]
|
11
|
+
s.email = ['a.hamid@nezam.io', 'zeyad.saleh@nezam.io']
|
12
12
|
|
13
13
|
s.required_ruby_version = '>= 2.3.0'
|
14
14
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qalam_merit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.09
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Tute Costa
|
8
7
|
- Ahmed Abdelhamid
|
8
|
+
- Zeyad Saleh
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: zeitwerk
|
@@ -111,8 +111,8 @@ dependencies:
|
|
111
111
|
version: '0'
|
112
112
|
description: Manage badges, points and rankings (reputation) in your Rails app.
|
113
113
|
email:
|
114
|
-
- tutecosta@gmail.com
|
115
114
|
- a.hamid@nezam.io
|
115
|
+
- zeyad.saleh@nezam.io
|
116
116
|
executables: []
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|