sportdb-models 1.16.2 → 1.17.0
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.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/sportdb/schema.rb +25 -24
- data/lib/sportdb/version.rb +2 -3
- data/test/test_reader_from_string.rb +4 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2bdecfa31a07aeef927ef1a0f287ad27ba57fee
|
4
|
+
data.tar.gz: ee12cdb555d85ca403b6674d7618824f65d391d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dfeeed897d041f727652e90066850b0a2d623af67c3dee3a79f3851a312d364374fe09058865f0d7b9e4b2be6f66d66776d4534f91780f4261e4a8e721f537e
|
7
|
+
data.tar.gz: 2dc970f7f0c74f4e4aa469e143f1797a2de9cbc58b4bff72ad2a0fc27e36342e69e025d94d0259e0439937177f3ee86b990bbdbcfea182e70613d3a98b10e09f
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
[](http://travis-ci.org/geraldb/sport.db.ruby)
|
5
5
|
-->
|
6
6
|
|
7
|
-
* home :: [github.com/sportdb/sport.db
|
8
|
-
* bugs :: [github.com/sportdb/sport.db
|
7
|
+
* home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
|
8
|
+
* bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
|
9
9
|
* gem :: [rubygems.org/gems/sportdb-models](https://rubygems.org/gems/sportdb-models)
|
10
10
|
* rdoc :: [rubydoc.info/gems/sportdb-models](http://rubydoc.info/gems/sportdb-models)
|
11
11
|
* forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
|
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
## License
|
20
20
|
|
21
|
+

|
22
|
+
|
21
23
|
The `sportdb-models` scripts are dedicated to the public domain.
|
22
24
|
Use it as you please with no restrictions whatsoever.
|
23
25
|
|
data/lib/sportdb/schema.rb
CHANGED
@@ -33,9 +33,9 @@ add_index :teams, :key, unique: true
|
|
33
33
|
# check: use table (rename to) venues / stadiums - why? why not?
|
34
34
|
create_table :grounds do |t|
|
35
35
|
t.string :key, null: false # import/export key
|
36
|
-
t.string :title, null: false
|
36
|
+
t.string :title, null: false
|
37
37
|
t.string :synonyms # comma separated list of synonyms
|
38
|
-
|
38
|
+
|
39
39
|
t.references :country, null: false
|
40
40
|
t.references :city # todo: make city required ???
|
41
41
|
|
@@ -48,7 +48,7 @@ create_table :grounds do |t|
|
|
48
48
|
## - add capacity e.g. 40_000
|
49
49
|
## fix: add address !!!! etc
|
50
50
|
|
51
|
-
## add region ??? or just use region from city ??
|
51
|
+
## add region ??? or just use region from city ??
|
52
52
|
|
53
53
|
t.timestamps
|
54
54
|
end
|
@@ -67,7 +67,7 @@ create_table :goals do |t|
|
|
67
67
|
|
68
68
|
t.integer :score1
|
69
69
|
t.integer :score2
|
70
|
-
|
70
|
+
|
71
71
|
## type of goal (penalty, owngoal)
|
72
72
|
t.boolean :penalty, null: false, default: false
|
73
73
|
t.boolean :owngoal, null: false, default: false # de: Eigentor -> # todo: find better name?
|
@@ -111,7 +111,7 @@ add_index :events, :key, unique: true
|
|
111
111
|
|
112
112
|
|
113
113
|
create_table :rounds do |t|
|
114
|
-
t.references :event, null: false
|
114
|
+
t.references :event, null: false, index: false ## Note: do NOT auto-add index
|
115
115
|
t.string :title, null: false
|
116
116
|
t.string :title2
|
117
117
|
t.integer :pos, null: false
|
@@ -132,7 +132,7 @@ add_index :rounds, :event_id # fk event_id index
|
|
132
132
|
|
133
133
|
|
134
134
|
create_table :groups do |t| # Teamgruppe (zB Gruppe A, Gruppe B, etc.)
|
135
|
-
t.references :event, null: false
|
135
|
+
t.references :event, null: false, index: false ## Note: do NOT auto-add index
|
136
136
|
t.string :title, null: false
|
137
137
|
t.integer :pos, null: false
|
138
138
|
t.timestamps
|
@@ -140,15 +140,16 @@ end
|
|
140
140
|
|
141
141
|
add_index :groups, :event_id # fk event_id index
|
142
142
|
|
143
|
+
|
143
144
|
###########################
|
144
145
|
# fix: rename table to matches
|
145
146
|
create_table :games do |t|
|
146
147
|
t.string :key # import/export key
|
147
|
-
t.references :round, null: false
|
148
|
+
t.references :round, null: false, index: false ## Note: do NOT auto-add index
|
148
149
|
t.integer :pos, null: false
|
149
|
-
t.references :group
|
150
|
-
t.references :team1, null: false
|
151
|
-
t.references :team2, null: false
|
150
|
+
t.references :group, index: false ## Note: do NOT auto-add index -- group is optional
|
151
|
+
t.references :team1, null: false, index: false ## Note: do NOT auto-add index
|
152
|
+
t.references :team2, null: false, index: false ## Note: do NOT auto-add index
|
152
153
|
|
153
154
|
t.datetime :play_at, null: false
|
154
155
|
t.boolean :postponed, null: false, default: false
|
@@ -171,11 +172,11 @@ create_table :games do |t|
|
|
171
172
|
t.integer :score2i # half time - team 2
|
172
173
|
t.integer :score1ii # second third (opt)
|
173
174
|
t.integer :score2ii # second third - team2 (opt)
|
174
|
-
t.references :next_game
|
175
|
-
t.references :prev_game
|
175
|
+
t.references :next_game, index: false ## Note: do NOT auto-add index -- for hinspiel bei rueckspiel in knockout game
|
176
|
+
t.references :prev_game, index: false ## Note: do NOT auto-add index
|
176
177
|
|
177
178
|
t.integer :winner # 1,2,0,nil calculate on save - "real" winner (after 90 or extra time or penalty, aggregated first+second leg?)
|
178
|
-
t.integer :winner90 # 1,2,0,nil calculate on save - winner after 90 mins (or regugular play time depending on sport - add alias or find a better name!)
|
179
|
+
t.integer :winner90 # 1,2,0,nil calculate on save - winner after 90 mins (or regugular play time depending on sport - add alias or find a better name!)
|
179
180
|
|
180
181
|
t.timestamps
|
181
182
|
end
|
@@ -191,8 +192,8 @@ add_index :games, :team2_id
|
|
191
192
|
|
192
193
|
# todo: remove id from join table (without extra fields)? why?? why not??
|
193
194
|
create_table :events_teams do |t|
|
194
|
-
t.references :event, null: false
|
195
|
-
t.references :team, null: false
|
195
|
+
t.references :event, null: false, index: false ## Note: do NOT auto-add index
|
196
|
+
t.references :team, null: false, index: false ## Note: do NOT auto-add index
|
196
197
|
t.timestamps
|
197
198
|
end
|
198
199
|
|
@@ -202,8 +203,8 @@ add_index :events_teams, :event_id
|
|
202
203
|
|
203
204
|
# todo: remove id from join table (without extra fields)? why?? why not??
|
204
205
|
create_table :events_grounds do |t|
|
205
|
-
t.references :event, null: false
|
206
|
-
t.references :ground, null: false
|
206
|
+
t.references :event, null: false, index: false ## Note: do NOT auto-add index
|
207
|
+
t.references :ground, null: false, index: false ## Note: do NOT auto-add index
|
207
208
|
t.timestamps
|
208
209
|
end
|
209
210
|
|
@@ -213,8 +214,8 @@ add_index :events_grounds, :event_id
|
|
213
214
|
|
214
215
|
|
215
216
|
create_table :groups_teams do |t|
|
216
|
-
t.references :group, null: false
|
217
|
-
t.references :team, null: false
|
217
|
+
t.references :group, null: false, index: false ## Note: do NOT auto-add index
|
218
|
+
t.references :team, null: false, index: false ## Note: do NOT auto-add index
|
218
219
|
t.timestamps
|
219
220
|
end
|
220
221
|
|
@@ -234,7 +235,7 @@ create_table :leagues do |t| ## also for cups/conferences/tournaments/world ser
|
|
234
235
|
t.string :key, null: false
|
235
236
|
t.string :title, null: false # e.g. Premier League, Deutsche Bundesliga, World Cup, Champions League, etc.
|
236
237
|
t.references :country ## optional for now , :null => false ### todo: create "virtual" country for international leagues e.g. use int? or world (ww?)/europe (eu)/etc. similar? already taken??
|
237
|
-
|
238
|
+
|
238
239
|
## fix: rename to :clubs from :club
|
239
240
|
t.boolean :club, null: false, default: false # club teams or national teams?
|
240
241
|
## todo: add t.boolean :national flag? for national teams?
|
@@ -277,8 +278,8 @@ add_index :assocs, :key, unique: true
|
|
277
278
|
|
278
279
|
|
279
280
|
create_table :assocs_assocs do |t|
|
280
|
-
t.references :assoc1, null: false
|
281
|
-
t.references :assoc2, null: false
|
281
|
+
t.references :assoc1, null: false, index: false ## Note: do NOT auto-add index -- parent assoc
|
282
|
+
t.references :assoc2, null: false, index: false ## Note: do NOT auto-add index -- child assoc is_member_of parent assoc
|
282
283
|
t.timestamps
|
283
284
|
end
|
284
285
|
|
@@ -359,7 +360,7 @@ create_table :alltime_standing_entries do |t|
|
|
359
360
|
t.integer :goals_against # todo: find a shorter name - ga? why? why not?
|
360
361
|
t.integer :pts
|
361
362
|
t.integer :recs # note: specific to alltime - stats records counter (e.g. appearance counter)
|
362
|
-
t.string :comments
|
363
|
+
t.string :comments
|
363
364
|
t.timestamps
|
364
365
|
end
|
365
366
|
|
@@ -370,4 +371,4 @@ end # method up
|
|
370
371
|
|
371
372
|
end # class CreateDb
|
372
373
|
|
373
|
-
end # module SportDb
|
374
|
+
end # module SportDb
|
data/lib/sportdb/version.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
module SportDb
|
4
4
|
|
5
5
|
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
6
|
-
MINOR =
|
7
|
-
PATCH =
|
6
|
+
MINOR = 17
|
7
|
+
PATCH = 0
|
8
8
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
9
9
|
|
10
10
|
def self.version
|
@@ -20,4 +20,3 @@ module SportDb
|
|
20
20
|
end
|
21
21
|
|
22
22
|
end # module SportDb
|
23
|
-
|
@@ -19,7 +19,7 @@ class TestReaderFromString < MiniTest::Test
|
|
19
19
|
|
20
20
|
def test_bl
|
21
21
|
at = Country.create!( key: 'at', name: 'Austria', code: 'AUT', pop: 1, area: 1)
|
22
|
-
|
22
|
+
|
23
23
|
teamreader = TestTeamReader.from_file( 'at-austria/teams', country_id: at.id )
|
24
24
|
teamreader.read()
|
25
25
|
|
@@ -36,9 +36,8 @@ class TestReaderFromString < MiniTest::Test
|
|
36
36
|
assert_equal 0, bl.games.count # 36x5 = 180
|
37
37
|
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
bl_txt_ii = File.read( "#{SportDb.test_data_path}/at-austria/2013_14/bl_ii.txt" )
|
39
|
+
bl_txt = File.open( "#{SportDb.test_data_path}/at-austria/2013_14/bl.txt", 'r:bom|utf-8' ).read
|
40
|
+
bl_txt_ii = File.open( "#{SportDb.test_data_path}/at-austria/2013_14/bl_ii.txt", 'r:bom|utf-8' ).read
|
42
41
|
|
43
42
|
text_ary = [bl_txt,bl_txt_ii]
|
44
43
|
|
@@ -52,7 +51,7 @@ class TestReaderFromString < MiniTest::Test
|
|
52
51
|
|
53
52
|
assert_equal 36, bl.rounds.count
|
54
53
|
assert_equal 180, bl.games.count # 36x5 = 180
|
55
|
-
|
54
|
+
|
56
55
|
## check if is stable (update will not create new matches and rounds) on second pass/rerun
|
57
56
|
gamereader.read()
|
58
57
|
|
@@ -62,4 +61,3 @@ class TestReaderFromString < MiniTest::Test
|
|
62
61
|
|
63
62
|
|
64
63
|
end # class TestReaderFromString
|
65
|
-
|
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.
|
4
|
+
version: 1.17.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:
|
11
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: worlddb-models
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.16'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.16'
|
69
69
|
description: sportdb-models - sport.db schema 'n' models for easy (re)use
|
70
70
|
email: opensport@googlegroups.com
|
71
71
|
executables: []
|
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.2
|
271
|
+
rubygems_version: 2.5.2
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: sportdb-models - sport.db schema 'n' models for easy (re)use
|