sportdb-readers 1.1.1 → 1.1.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.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/sportdb/readers/match_reader.rb +31 -5
- data/lib/sportdb/readers/version.rb +1 -1
- data/test/helper.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b92858d91cd8a8229f492aba44a58e3dd6be1b40
|
|
4
|
+
data.tar.gz: 36d490bff1de4f88216e4092abc73927a1fb0de6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b509fe042ac69758777e838f245d929807c23ccc3276d1216d0dc127fd54f1758a3474a56469b5c42fb073862431a96bcd85fa78b15979e61272251cfb61237
|
|
7
|
+
data.tar.gz: cb9b1868690d2cd36c9ae2cc50a2cef6962192f072bf5cd70710f9942439d62dbfbb8f6fa67908eddb69853f6a1284840a6502f5daf237864059a716aaf2511e
|
data/Rakefile
CHANGED
|
@@ -36,8 +36,9 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
|
36
36
|
'it' => 'it', ## it - Italian
|
|
37
37
|
'es' => 'es', ## es - Español (Spanish)
|
|
38
38
|
'mx' => 'es',
|
|
39
|
+
'ar' => 'es', ## Argentina
|
|
39
40
|
'pt' => 'pt', ## pt - Português (Portuguese)
|
|
40
|
-
'br' => '
|
|
41
|
+
'br' => 'pt',
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
secs.each do |sec| ## sec(tion)s
|
|
@@ -69,6 +70,8 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
|
69
70
|
end
|
|
70
71
|
end
|
|
71
72
|
|
|
73
|
+
|
|
74
|
+
### todo/check: make sure team include teams from group def too!!!!!
|
|
72
75
|
auto_conf_teams, _ = AutoConfParser.parse( lines,
|
|
73
76
|
start: start )
|
|
74
77
|
|
|
@@ -81,7 +84,10 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
|
81
84
|
## todo/fix: make more generic / reuseable!!!!
|
|
82
85
|
mods = {}
|
|
83
86
|
## europa league uses same mods as champions league
|
|
84
|
-
mods[ 'uefa.el
|
|
87
|
+
mods[ 'uefa.el.quali' ] =
|
|
88
|
+
mods[ 'uefa.cl.quali' ] =
|
|
89
|
+
mods[ 'uefa.el' ] =
|
|
90
|
+
mods[ 'uefa.cl' ] = catalog.clubs.build_mods(
|
|
85
91
|
{ 'Liverpool | Liverpool FC' => 'Liverpool FC, ENG',
|
|
86
92
|
'Arsenal | Arsenal FC' => 'Arsenal FC, ENG',
|
|
87
93
|
'Barcelona' => 'FC Barcelona, ESP',
|
|
@@ -133,12 +139,32 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
|
133
139
|
end
|
|
134
140
|
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
## build a lookup cache for team_recs (used by group lookup)
|
|
143
|
+
## lookup by "canonical" name
|
|
144
|
+
cache_team_recs = new_team_recs.reduce({}) { |h,rec| h[rec.name] = rec; h }
|
|
139
145
|
|
|
140
146
|
groups.each do |group|
|
|
141
147
|
group_rec = Sync::Group.find_or_create( group, event: event_rec ) ## check: use/rename to EventGroup why? why not?
|
|
148
|
+
|
|
149
|
+
########
|
|
150
|
+
## add/update teams - todo/fix/clean-up - find a better way or move to sync? - possible?
|
|
151
|
+
## e.g. group.teams assumes an array of team names e.g.
|
|
152
|
+
## ["Spain", "Czech Republic", "Turkey", "Croatia"]
|
|
153
|
+
group_team_ids = []
|
|
154
|
+
group.teams.each do |team_name|
|
|
155
|
+
team_rec = cache_team_recs[ team_name ]
|
|
156
|
+
if team_rec.nil? ## assume team MUST always be present/known in mapping (via autoconfig parser)
|
|
157
|
+
puts "!! ERROR - no (cached) team rec found for team in group >#{group.name}< for >#{team_name}<"
|
|
158
|
+
exit 1
|
|
159
|
+
end
|
|
160
|
+
group_team_ids << team_rec.id
|
|
161
|
+
end
|
|
162
|
+
group_rec.team_ids = group_team_ids ## reset/update all teams at once (via ids)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
rounds.each do |round|
|
|
167
|
+
round_rec = Sync::Round.find_or_create( round, event: event_rec ) ## check: use/rename to EventRound why? why not?
|
|
142
168
|
end
|
|
143
169
|
|
|
144
170
|
matches.each do |match|
|
data/test/helper.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## note: use the local version of sportdb gems
|
|
2
2
|
$LOAD_PATH.unshift( File.expand_path( '../sportdb-formats/lib' ))
|
|
3
|
-
$LOAD_PATH.unshift( File.expand_path( '../sportdb-
|
|
3
|
+
$LOAD_PATH.unshift( File.expand_path( '../sportdb-catalogs/lib' ))
|
|
4
4
|
$LOAD_PATH.unshift( File.expand_path( '../sportdb-models/lib' ))
|
|
5
5
|
$LOAD_PATH.unshift( File.expand_path( '../sportdb-sync/lib' ))
|
|
6
6
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sportdb-readers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gerald Bauer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-08-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sportdb-sync
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.1.
|
|
19
|
+
version: 1.1.1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.1.
|
|
26
|
+
version: 1.1.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rdoc
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|