arkaan 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkaan/campaign.rb +12 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa9c1beeceeeeea892222da50ff76cdda7292972
|
4
|
+
data.tar.gz: dba53cfc47a60fadf5b6aee7eef2884145ac8f41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4a9fc2e8f4630bff017da345762e96c332eee15f1b7bc6abcf6a8341f64a95cc11fd1e94dba38b407ab6b80cac84965c3b4b76bf97524accc3b4b02a5cb38de
|
7
|
+
data.tar.gz: 9c1942f2c13da935500be2a856b60f0a56dbb36e849bb2fd0a24ac3cac968626124049ea8caa8f66d65de4f30d26e8a96f650f880b047beb2cdbfdafdf5a669d
|
data/lib/arkaan/campaign.rb
CHANGED
@@ -39,11 +39,10 @@ module Arkaan
|
|
39
39
|
validates :max_players,
|
40
40
|
numericality: {less_than: 21, message: 'maximum'}
|
41
41
|
|
42
|
-
validates :max_players,
|
43
|
-
numericality: {greater_than: 0, message: 'minimum'}
|
44
|
-
|
45
42
|
validate :title_unicity
|
46
43
|
|
44
|
+
validate :max_players_minimum
|
45
|
+
|
47
46
|
# Sets the creator of the campaign. This method is mainly used for backward-compatibility needs.
|
48
47
|
# @param account [Arkaan::Account] the account of the creator for this campaign.
|
49
48
|
def creator=(account)
|
@@ -68,5 +67,15 @@ module Arkaan
|
|
68
67
|
errors.add(:title, 'uniq')
|
69
68
|
end
|
70
69
|
end
|
70
|
+
|
71
|
+
def max_players_minimum
|
72
|
+
if max_players? && (max_players < players_count || max_players < 1)
|
73
|
+
errors.add(:max_players, 'minimum')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def players_count
|
78
|
+
invitations.where(enum_status: :accepted).count
|
79
|
+
end
|
71
80
|
end
|
72
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arkaan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|