icu_tournament 1.5.5 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -204,6 +204,7 @@ module ICU
204
204
  csv << ["Website", t.site]
205
205
  t.players.each do |p|
206
206
  next unless p.id
207
+ next unless p.results.size == t.rounds
207
208
  csv << []
208
209
  csv << ["Player", p.id, p.last_name, p.first_name]
209
210
  (1..t.rounds).each do |n|
@@ -236,16 +237,22 @@ module ICU
236
237
  raise "there must be at least one ICU player (with an ID number)" if icu.size == 0
237
238
  foreign = t.players.find_all { |p| !p.id }
238
239
  raise "all foreign players must have a federation" if foreign.detect { |f| !f.fed }
240
+ enough = false
239
241
  icu.each do |p|
240
242
  rated = 0
243
+ results = 0
241
244
  (1..t.rounds).each do |r|
242
245
  result = p.find_result(r)
243
- raise "ICU players must have a result in every round" unless result
244
- raise "all opponents of ICU players must have a federation" if result.opponent && !t.player(result.opponent).fed
245
- rated += 1 if result.opponent && t.player(result.opponent).fide_rating
246
+ if result
247
+ results += 1
248
+ raise "all opponents of ICU players must have a federation" if result.opponent && !t.player(result.opponent).fed
249
+ rated += 1 if result.opponent && t.player(result.opponent).fide_rating
250
+ end
246
251
  end
247
252
  raise "player #{p.num} (#{p.name}) has no rated opponents" if rated == 0
253
+ enough = true if results == t.rounds
248
254
  end
255
+ raise "at least one ICU player (with an ID number) must have a result in every round" unless enough
249
256
  end
250
257
 
251
258
  # :enddoc:
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ICU
4
4
  class Tournament
5
- VERSION = "1.5.5"
5
+ VERSION = "1.5.6"
6
6
  end
7
7
  end
@@ -677,11 +677,10 @@ CSV
677
677
  @t.invalid(:type => @p).to_s.should match(/federation/)
678
678
  end
679
679
 
680
- it "should fail unless every ICU player has a result in every round" do
681
- @t.add_player(ICU::Player.new('Mark', 'Orr', 3, :id => 1350))
682
- @t.add_result(ICU::Result.new(1, 3, 'W', :opponent => 30, :colour => 'B'))
683
- @t.invalid(:type => @p).to_s.should match(/result/)
684
- @t.add_result(ICU::Result.new(2, 3, 'W', :opponent => 10, :colour => 'W'))
680
+ it "should fail unless at least one ICU player has a result in every round" do
681
+ @t.add_result(ICU::Result.new(3, 10, 'W', :opponent => 30, :colour => 'W'))
682
+ @t.invalid(:type => @p).to_s.should match(/at least one.*result.*every/)
683
+ @t.add_result(ICU::Result.new(3, 1, 'W', :opponent => 20, :colour => 'W'))
685
684
  @t.invalid(:type => @p).should be_false
686
685
  end
687
686
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icu_tournament
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5
4
+ version: 1.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-16 00:00:00.000000000Z
12
+ date: 2011-11-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dbf
16
- requirement: &70266168398620 !ruby/object:Gem::Requirement
16
+ requirement: &70177626248320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70266168398620
24
+ version_requirements: *70177626248320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rubyzip
27
- requirement: &70266168397220 !ruby/object:Gem::Requirement
27
+ requirement: &70177626247820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70266168397220
35
+ version_requirements: *70177626247820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: icu_name
38
- requirement: &70266168331460 !ruby/object:Gem::Requirement
38
+ requirement: &70177626247360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70266168331460
46
+ version_requirements: *70177626247360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70266168330560 !ruby/object:Gem::Requirement
49
+ requirement: &70177626246980 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70266168330560
57
+ version_requirements: *70177626246980
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &70266168329420 !ruby/object:Gem::Requirement
60
+ requirement: &70177626292080 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70266168329420
68
+ version_requirements: *70177626292080
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70266168328480 !ruby/object:Gem::Requirement
71
+ requirement: &70177626291660 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70266168328480
79
+ version_requirements: *70177626291660
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-rspec
82
- requirement: &70266168327280 !ruby/object:Gem::Requirement
82
+ requirement: &70177626291240 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70266168327280
90
+ version_requirements: *70177626291240
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rdoc
93
- requirement: &70266168325800 !ruby/object:Gem::Requirement
93
+ requirement: &70177626290820 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70266168325800
101
+ version_requirements: *70177626290820
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rb-fsevent
104
- requirement: &70266168324640 !ruby/object:Gem::Requirement
104
+ requirement: &70177626290360 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70266168324640
112
+ version_requirements: *70177626290360
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: growl
115
- requirement: &70266165709760 !ruby/object:Gem::Requirement
115
+ requirement: &70177626289940 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70266165709760
123
+ version_requirements: *70177626289940
124
124
  description: Convert files of chess tournament data in different formats to ruby classes
125
125
  and vice-versa.
126
126
  email: mark.j.l.orr@googlemail.com
@@ -171,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
171
  version: '0'
172
172
  segments:
173
173
  - 0
174
- hash: 2742287877822509535
174
+ hash: 858182748560082174
175
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  none: false
177
177
  requirements:
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  segments:
182
182
  - 0
183
- hash: 2742287877822509535
183
+ hash: 858182748560082174
184
184
  requirements: []
185
185
  rubyforge_project: icu_tournament
186
186
  rubygems_version: 1.8.6