sportdb-models 1.13.0 → 1.14.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
  SHA1:
3
- metadata.gz: 6581b2503f64b81e2e13054cfd6fcdc82ef1cd92
4
- data.tar.gz: 53c61cb4597030a55359c09a8952d2ffa3b3d0ee
3
+ metadata.gz: 2cebb6c98e88a5cbb12889d6a90b4a890d09ac21
4
+ data.tar.gz: 7d9017176287c6f00a2a209fa6a9e1877fabf286
5
5
  SHA512:
6
- metadata.gz: 8e07c41d35dbd0beff9d7ac7d90256d83d5d176140b246f9271afaf246b2ddeef7082632743e8db3f3bdb9364d93e19357541d4509d53b897ce68643e4cbb7ef
7
- data.tar.gz: c5240235260c31b5968e2069b0797b6d8f56d5c9aa271f6e0e55e8255da43829e874cb8b5afa4489c15fc0ac9b6cdeffdcc7f768055e290578c9fa66f89f577b
6
+ metadata.gz: 42901342ef3482dfc37ad8abb60b0870c91c718922c85493129249e7ab4ca55bb95aa8fcba3e3f9a04f57b513705003eefddfd55828301e44186e432bc682c53
7
+ data.tar.gz: d514e02328829f767cac4bf4b75499ba9e9acf4358498e8a77bd8043869120720b9e138b38ed0eeed02bcb1f4d64d77fa3d25588b7e8883f642d8c58c2fc36f0
data/Manifest.txt CHANGED
@@ -83,6 +83,8 @@ test/data/at-austria/2013_14/el.yml
83
83
  test/data/at-austria/2013_14/squads/austria.txt
84
84
  test/data/at-austria/2013_14/squads/salzburg.txt
85
85
  test/data/at-austria/2014_15/1-bundesliga-ii.txt
86
+ test/data/at-austria/2015_16/1-bundesliga.yml
87
+ test/data/at-austria/2015_16/cup.yml
86
88
  test/data/at-austria/leagues.txt
87
89
  test/data/at-austria/teams.txt
88
90
  test/data/at-austria/teams_2.txt
@@ -127,6 +129,7 @@ test/test_assoc_reader.rb
127
129
  test/test_changes.rb
128
130
  test/test_cursor.rb
129
131
  test/test_date.rb
132
+ test/test_event_reader.rb
130
133
  test/test_goals.rb
131
134
  test/test_lang.rb
132
135
  test/test_load.rb
@@ -140,13 +140,42 @@ class EventReader
140
140
  end
141
141
 
142
142
  event_attribs['ground_ids'] = ground_ids
143
- elsif key == 'teams'
143
+
144
+ elsif key == 'team3' ## note: check before teams (to avoid future gotchas)
145
+ ## for now always assume false # todo: fix - use value and convert to boolean if not boolean
146
+ event_attribs['team3'] = false
147
+
148
+ elsif key == 'teams' || key.downcase =~ /teams/
144
149
  ## assume teams value is an array
145
-
150
+
151
+ ### check if key includes number of teams; if yes - use for checksum/assert
152
+ if key =~ /(\d+)/
153
+ if value.size != $1.to_i
154
+ puts "[fatal] event reader - team key - expecting #{$1.to_i} teams; got #{value.size}"
155
+ exit 1
156
+ end
157
+ end
158
+
146
159
  team_ids = []
147
160
  value.each do |item|
148
161
  team_key = item.to_s.strip
149
- team = Team.find_by_key( team_key )
162
+
163
+ ## check if team_key includes uppercase letters
164
+ if team_key =~ /[A-Z]/
165
+ ## assume team name (NOT team key); try to lookup team key in database
166
+ ## todo/fix:
167
+ ## remove subtitle from title e.g. everything in ()
168
+ ## SV Oberwart (RL Ost) => SV Oberwart
169
+ team = Team.find_by( title: team_key )
170
+ if team.nil?
171
+ ## next try synonyms
172
+ team = Team.where( "synonyms LIKE ?", "%#{team_key}%" ).first
173
+ end
174
+ else
175
+ ## assume "verbatim/literal" team_key (use as is 1:1)
176
+ team = Team.find_by( key: team_key )
177
+ end
178
+
150
179
  if team.nil?
151
180
  ### print better error message than just
152
181
  ## *** error: Couldn't find SportDb::Model::Team
@@ -155,14 +184,11 @@ class EventReader
155
184
  exit 1
156
185
  ### fix/todo: throw exception/error
157
186
  end
187
+
158
188
  team_ids << team.id
159
189
  end
160
190
 
161
191
  event_attribs['team_ids'] = team_ids
162
-
163
- elsif key == 'team3'
164
- ## for now always assume false # todo: fix - use value and convert to boolean if not boolean
165
- event_attribs['team3'] = false
166
192
 
167
193
  elsif key == 'fixtures' || key == 'sources'
168
194
  ### todo: check for mulitiple fixtures/sources ?? allow disallow?? why? why not?
@@ -3,7 +3,7 @@
3
3
  module SportDb
4
4
 
5
5
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 13
6
+ MINOR = 14
7
7
  PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
@@ -0,0 +1,28 @@
1
+ #########################################################################
2
+ # Österreichische Bundesliga 2015/16 (104. Meisterschaft / 42. Saison)
3
+
4
+ league: at
5
+ season: 2015/16
6
+ start_at: 2015-07-25
7
+
8
+ # num/edition - 104 or 42 ?? ##
9
+ # note: timezone for games (play_at) is *always* CET (central european time)
10
+
11
+ fixtures:
12
+ - 1-bundesliga-i
13
+ - 1-bundesliga-ii
14
+
15
+
16
+ 10 Teams:
17
+ - RB Salzburg
18
+ - Rapid Wien
19
+ - Sturm Graz
20
+ - Wolfsberger AC
21
+ - SV Ried
22
+ - Austria Wien
23
+ - Admira Wacker
24
+ - SCR Altach
25
+ - SV Grödig
26
+ - SV Mattersburg ## Aufsteiger
27
+
28
+
@@ -0,0 +1,77 @@
1
+ #################################
2
+ # ÖFB Cup 2015/16
3
+
4
+ league: at.cup
5
+ season: 2015/16
6
+ start_at: 2015-07-17
7
+ team3: false # no game for 3rd/4th place
8
+
9
+ # note: timezone for games (play_at) is *always* CET (central european time)
10
+
11
+
12
+ 64 Teams:
13
+ - RB Salzburg ## Bundesliga (10)
14
+ - Rapid Wien
15
+ - Admira Wacker
16
+ - Austria Wien
17
+ - Sturm Graz
18
+ - SV Ried
19
+ - SCR Altach
20
+ - SV Mattersburg
21
+ - SV Grödig
22
+ - Wolfsburger AC
23
+ - KSV 1919 ## Erste Liga (9) - excl. FC Liefering
24
+ - Wacker Innsbruck
25
+ - Austria Lustenau
26
+ - SKN St. Pölten
27
+ - SC Wr. Neustadt
28
+ - Austria Klagenfurt
29
+ - LASK Linz
30
+ - Austria Salzburg
31
+ - Floridsdorfer AC
32
+ - SC/ESV Parndorf 1919 (RL Ost) ## Burgenland (4)
33
+ - SC Ritzing (RL Ost)
34
+ - SV Oberwart (RL Ost)
35
+ - SC Trausdorf (2. Liga Nord Burgenland)
36
+ - SV Schwechat (RL Ost) ## Wien (5)
37
+ - First Vienna FC 1894 (RL Ost)
38
+ - FC Stadlau (RL Ost)
39
+ - Wiener Sportklub (RL Ost)
40
+ - SC Red Star Penzing (2. LL Wien)
41
+ - 1. SC Sollenau (RL Ost) ## Niederösterreich (7)
42
+ - SV Horn (RL Ost)
43
+ - ASK Ebreichsdorf (RL Ost)
44
+ - SKU Amstetten (RL Ost)
45
+ - SC Krems (NÖ Landesliga)
46
+ - SV Leobendorf (NÖ Landesliga)
47
+ - ASK Kottingsbrunn (NÖ Landesliga)
48
+ - SV Wallern (RL Mitte) ## Oberösterreich (6)
49
+ - Union Gurten (RL Mitte)
50
+ - FC Blau Weiß Linz (RL Mitte)
51
+ - SK Vorwärts Steyr (RL Mitte)
52
+ - ATSV Stadl Paura (RL Mitte)
53
+ - FC Wels (OÖ Liga)
54
+ - SV Seekirchen 1945 (RL West) ## Salzburg (5)
55
+ - TSV Neumarkt (RL West)
56
+ - TSV St. Johann Pongau (RL West)
57
+ - USC Eugendorf (RL West)
58
+ - SC Golling (Salzburger Liga)
59
+ - SV Lafnitz (RL Mitte) ## Steiermark (6)
60
+ - TSV Hartberg (RL Mitte)
61
+ - SC Weiz (RL Mitte)
62
+ - Deutschlandsberger SC (RL Mitte)
63
+ - SV Allerheiligen (RL Mitte)
64
+ - FC Piberstein Lankowitz (LL Steiermark)
65
+ - ASV Annabichler SV 1923 (RL Mitte) ## Kärnten (4)
66
+ - ASKÖ Köttmannsdorf (Kärntner Liga)
67
+ - VST Völkermarkt (Kärntner Liga)
68
+ - FC Lendorf (Kärntner Liga)
69
+ - WSG Wattens (RL West) ## Tirol (4)
70
+ - SVG Reichenau (RL West)
71
+ - FC Kitzbühel (RL West)
72
+ - SV Innsbruck (Tiroler Liga)
73
+ - FC Hard (RL West) ## Vorarlberg (4)
74
+ - FC Dornbirn 1913 (RL West)
75
+ - SC Schwarz Weiß Bregenz (RL West)
76
+ - FC Höchst (Vorarlberg-Liga)
77
+
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_event_reader.rb
6
+ # or better
7
+ # rake -I ./lib test
8
+
9
+
10
+ require 'helper'
11
+
12
+ class TestEventReaderXX < MiniTest::Test # note: TestEventReader alreay defined, thus, add xx
13
+
14
+ def setup
15
+ WorldDb.delete!
16
+ SportDb.delete!
17
+ PersonDb.delete!
18
+ end
19
+
20
+ def test_bl
21
+ at = Country.create!( key: 'at', name: 'Austria', code: 'AUT', pop: 1, area: 1)
22
+ season = Season.create!( key: '2015/16', title: '2015/16' )
23
+ bl = League.create!( key: 'at', title: 'Bundesliga', club: true, country_id: at.id )
24
+
25
+ ## read teams (required for db key lookup)
26
+ teamreader = TestTeamReader.from_file( 'at-austria/teams', country_id: at.id )
27
+ teamreader.read
28
+ teamreader = TestTeamReader.from_file( 'at-austria/teams_2', country_id: at.id )
29
+ teamreader.read
30
+
31
+ r = TestEventReader.from_file( 'at-austria/2015_16/1-bundesliga' )
32
+ r.read
33
+
34
+ assert true ## if we get here; assume everything ok
35
+ end
36
+
37
+ ### fix/todo:
38
+ ## to be done - add support for Wiener Sportklub (RL Ost) => Wiener Sportklub lookups
39
+ def xxxx_test_cup
40
+ at = Country.create!( key: 'at', name: 'Austria', code: 'AUT', pop: 1, area: 1)
41
+ season = Season.create!( key: '2015/16', title: '2015/16' )
42
+ cup = League.create!( key: 'at.cup', title: 'Cup', club: true, country_id: at.id )
43
+
44
+ r = TestEventReader.from_file( 'at-austria/2015_16/cup' )
45
+ r.read
46
+
47
+ assert true ## if we get here; assume everything ok
48
+ end
49
+
50
+ end # class TestEventReader
51
+
52
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-24 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: worlddb-models
@@ -161,6 +161,8 @@ files:
161
161
  - test/data/at-austria/2013_14/squads/austria.txt
162
162
  - test/data/at-austria/2013_14/squads/salzburg.txt
163
163
  - test/data/at-austria/2014_15/1-bundesliga-ii.txt
164
+ - test/data/at-austria/2015_16/1-bundesliga.yml
165
+ - test/data/at-austria/2015_16/cup.yml
164
166
  - test/data/at-austria/leagues.txt
165
167
  - test/data/at-austria/teams.txt
166
168
  - test/data/at-austria/teams_2.txt
@@ -205,6 +207,7 @@ files:
205
207
  - test/test_changes.rb
206
208
  - test/test_cursor.rb
207
209
  - test/test_date.rb
210
+ - test/test_event_reader.rb
208
211
  - test/test_goals.rb
209
212
  - test/test_lang.rb
210
213
  - test/test_load.rb
@@ -253,6 +256,7 @@ test_files:
253
256
  - test/test_load.rb
254
257
  - test/test_cursor.rb
255
258
  - test/test_standings.rb
259
+ - test/test_event_reader.rb
256
260
  - test/test_squad_club_reader.rb
257
261
  - test/test_scores.rb
258
262
  - test/test_winner.rb