icu_tournament 1.10.0 → 1.12.0

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: a381a56e723de1cfb4dd03d9b48d30bec0392949664a0ec79fb8436c293e0eef
4
- data.tar.gz: c3e6cb085ec3023bed84e7b9a1a081b542572150e63ee17a8c518cb37c36a46c
3
+ metadata.gz: 7b23a98b5c094ea8262c5950c0caf436c003dacdec3bcdd9498fd2facdaf3a71
4
+ data.tar.gz: d0885ac4a095bd87f12807bc4aee729969372a3496dcf72239ecfef13a67e782
5
5
  SHA512:
6
- metadata.gz: 79f24f02e5cc402a54b88dc3843666277ea05ce0713b3ed3130294518a04579693a8779fe0a5e38b8890ee69b604d79b4864ab830226db40812812b3d15d3d37
7
- data.tar.gz: 6d3db507492a9cccbdab10be94fc1fbd8de9b2a3f436c3746443c053eeec1b9157797fb23ee3dc3b4765110ce427b49d5a5e4ca53101f723828517af454063c5
6
+ metadata.gz: e6829bcc2c68fd3b5e202845e253e31f8d73e560b339ad19db97438e89525e6bc3821747ba843a1c58aa8dcda4a0e7e2fc1c0cc5d2929dc901511c1d1c461fac
7
+ data.tar.gz: 4ad015b1429a7e4888609437997d58ce616910e9e19c34c263bce48304d07751d721231e0c4da210c6d0cdf917d8b61a6258f4e53ef573ed32dd5ea8c6d17416
@@ -153,6 +153,7 @@ module ICU
153
153
  @title << 'M' if @title.match(/[A-LN-Z]$/)
154
154
  @title = 'IM' if @title == 'M'
155
155
  @title = 'WIM' if @title == 'WM'
156
+ @title = '' if @title.match(/^(AFM|AIM|AGM)$/)
156
157
  @title = nil if @title == ''
157
158
  raise "invalid chess title (#{title})" unless @title.nil? || @title.match(/^W?[GIFCN]M$/)
158
159
  end
@@ -431,6 +431,19 @@ module ICU
431
431
  end
432
432
  end
433
433
 
434
+ def normalize_score(score)
435
+ if score == "H"
436
+ return "="
437
+ elsif score == "Z"
438
+ return "0"
439
+ elsif score == "U"
440
+ return "-"
441
+ elsif score == "F"
442
+ return 1
443
+ end
444
+ score
445
+ end
446
+
434
447
  def add_result(round, player, data, full_byes, half_byes)
435
448
  data.strip!
436
449
  if data.match(/^-?$/)
@@ -438,14 +451,14 @@ module ICU
438
451
  return 0.0
439
452
  end
440
453
  data = "#{data} -" if data.match(/^(\d+)? (w|b|-)$/)
441
- if data.match(/^(0{1,4}|[1-9]\d{0,3}) (w|b|-) (1|0|=|\+|-)$/)
454
+ if data.match(/^(0{1,4}|[1-9]\d{0,3}) (w|b|-) (H|F|Z|U|1|0|=|\+|-)$/)
442
455
  opponent = $1.to_i
443
456
  colour = $2
444
- score = $3
457
+ score = normalize_score $3
445
458
  elsif data.match(/- (1|0|=|\+|-)$/)
446
459
  opponent = 0
447
460
  colour = "-"
448
- score = $1
461
+ score = normalize_score $1
449
462
  else
450
463
  raise "invalid result '#{data}'"
451
464
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ICU
4
4
  class Tournament
5
- VERSION = "1.10.0"
5
+ VERSION = "1.12.0"
6
6
  end
7
7
  end
data/spec/player_spec.rb CHANGED
@@ -133,6 +133,10 @@ module ICU
133
133
  expect(Player.new('Eamon', 'Keogh', 6, :title => 'nm').title).to eq('NM')
134
134
  expect { Player.new('Mark', 'Orr', 3, :title => 'Dr') }.to raise_error(/invalid chess title/)
135
135
  end
136
+
137
+ it "should ignore Arena titles" do
138
+ expect(Player.new('Darko', 'Polimac', 3, :title => 'AGM').title).to be_nil
139
+ end
136
140
  end
137
141
 
138
142
  context "rating" do
@@ -830,6 +830,13 @@ KRAUSE
830
830
  file = "#{@s}/armstrong_2012_with_bom.tab"
831
831
  expect { @p.parse_file!(file) }.not_to raise_error
832
832
  end
833
+
834
+ it "should handle Ulster Masters 2022 (H, Z, F for byes)" do
835
+ file = "#{@s}/UlsterMastersSeniors2022.tab"
836
+ expect { @p.parse_file!(file) }.not_to raise_error
837
+ end
838
+
839
+
833
840
  end
834
841
  end
835
842
  end
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.10.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Orr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-11 00:00:00.000000000 Z
12
+ date: 2022-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dbf
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.2'
110
+ version: '3.12'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.2'
117
+ version: '3.12'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rdoc
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -182,19 +182,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []
185
- rubygems_version: 3.0.1
185
+ rubygems_version: 3.0.3.1
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: For reading and writing files of chess tournament data.
189
189
  test_files:
190
+ - spec/tournament_spx_spec.rb
190
191
  - spec/team_spec.rb
192
+ - spec/spec_helper.rb
191
193
  - spec/player_spec.rb
192
194
  - spec/tournament_spec.rb
195
+ - spec/result_spec.rb
193
196
  - spec/tournament_fcsv_spec.rb
194
197
  - spec/tie_break_spec.rb
195
- - spec/tournament_spx_spec.rb
196
- - spec/result_spec.rb
197
198
  - spec/util_spec.rb
198
- - spec/spec_helper.rb
199
199
  - spec/tournament_sp_spec.rb
200
200
  - spec/tournament_krause_spec.rb