icu_tournament 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -122,7 +122,7 @@ module ICU
|
|
|
122
122
|
# Parse CSV data returning a Tournament on success or raising an exception on error.
|
|
123
123
|
def parse!(csv, arg={})
|
|
124
124
|
@state, @line, @round, @sum, @error = 0, 0, nil, nil, nil
|
|
125
|
-
@tournament = Tournament.new('
|
|
125
|
+
@tournament = Tournament.new('Unspecified', '2000-01-01')
|
|
126
126
|
csv = ICU::Util.to_utf8(csv) unless arg[:is_utf8]
|
|
127
127
|
|
|
128
128
|
CSV.parse(csv, :row_sep => :auto) do |r|
|
|
@@ -212,7 +212,7 @@ module ICU
|
|
|
212
212
|
# Parse Krause data returning a Tournament on success or raising an exception on error.
|
|
213
213
|
def parse!(krs, arg={})
|
|
214
214
|
@lineno = 0
|
|
215
|
-
@tournament = Tournament.new('
|
|
215
|
+
@tournament = Tournament.new('Unspecified', '2000-01-01')
|
|
216
216
|
@name_set, @start_set = false, false
|
|
217
217
|
@comments = ''
|
|
218
218
|
@results = Array.new
|
|
@@ -80,7 +80,7 @@ module ICU
|
|
|
80
80
|
|
|
81
81
|
# Parse SP data returning a Tournament or raising an exception on error.
|
|
82
82
|
def parse_file!(file, arg={})
|
|
83
|
-
@t = Tournament.new('
|
|
83
|
+
@t = Tournament.new('Unspecified', '2000-01-01')
|
|
84
84
|
@t.start = arg[:start] if arg[:start]
|
|
85
85
|
@bonus = {}
|
|
86
86
|
@start_no = {}
|
|
@@ -190,12 +190,14 @@ module ICU
|
|
|
190
190
|
raise "non-existant INI file (#{file})"
|
|
191
191
|
end
|
|
192
192
|
raise "invalid INI file (no sections)" if ini.size == 0
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
if ini["Tournament Info"]
|
|
194
|
+
%w(name arbiter rounds).each do |key|
|
|
195
|
+
val = (ini["Tournament Info"][key.capitalize] || '').squeeze(" ")
|
|
196
|
+
@t.send("#{key}=", val) if val.size > 0
|
|
197
|
+
end
|
|
196
198
|
end
|
|
197
|
-
if ini[
|
|
198
|
-
@t.tie_breaks = ini[
|
|
199
|
+
if ini["Standings"] && ini["Standings"]["Tie Breaks"]
|
|
200
|
+
@t.tie_breaks = ini["Standings"]["Tie Breaks"].to_s.split(/,/).map do |tbid|
|
|
199
201
|
case tbid.to_i # tie break name in SwissPerfect
|
|
200
202
|
when 1217 then :buchholz # Buchholz
|
|
201
203
|
when 1218 then :harkness # Median Buchholz
|
data/spec/tournament_sp_spec.rb
CHANGED
|
@@ -219,6 +219,20 @@ module ICU
|
|
|
219
219
|
end
|
|
220
220
|
end
|
|
221
221
|
|
|
222
|
+
context "Limerick CC, 2010-11, which has no 'Tournament Info' section in the INI file" do
|
|
223
|
+
before(:each) do
|
|
224
|
+
@p = ICU::Tournament::SwissPerfect.new
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it "should parse" do
|
|
228
|
+
@t = @p.parse_file(SAMPLES + 'limerick_cc_2011.zip', :start => "2010-10-15")
|
|
229
|
+
@p.error.should be_nil
|
|
230
|
+
@t.name.should == "Unspecified"
|
|
231
|
+
@t.rounds.should == 7
|
|
232
|
+
@t.arbiter.should be_nil
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
222
236
|
context "Non-existant ZIP file" do
|
|
223
237
|
before(:all) do
|
|
224
238
|
@p = ICU::Tournament::SwissPerfect.new
|
|
@@ -232,7 +246,6 @@ module ICU
|
|
|
232
246
|
end
|
|
233
247
|
|
|
234
248
|
context "Invalid ZIP file" do
|
|
235
|
-
|
|
236
249
|
before(:all) do
|
|
237
250
|
@p = ICU::Tournament::SwissPerfect.new
|
|
238
251
|
@t = @p.parse_file(SAMPLES + 'notazipfile.zip', :start => "2010-05-08")
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 1
|
|
7
7
|
- 4
|
|
8
|
-
-
|
|
9
|
-
version: 1.4.
|
|
8
|
+
- 2
|
|
9
|
+
version: 1.4.2
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Mark Orr
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2011-
|
|
17
|
+
date: 2011-05-16 00:00:00 +01:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|