sportdb-readers 1.1.1 → 1.1.2

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: d51d795ec384d281363b3af32bb6560bb0e7707a
4
- data.tar.gz: 6579ab0a20f45673f24ae4b444bc01d5c0f43d19
3
+ metadata.gz: b92858d91cd8a8229f492aba44a58e3dd6be1b40
4
+ data.tar.gz: 36d490bff1de4f88216e4092abc73927a1fb0de6
5
5
  SHA512:
6
- metadata.gz: 5b5ca27813390ab7fe3aa41e63897bbd0aa03c39d78dabed8a321eb3853528a2c1700c8dea4be57fe7fd3eb6122631878bdfb2beeed03ac81e545b4c9049dd4f
7
- data.tar.gz: 5c2a40f3fd42a0ec3eac82e942088a00bd2e7a6bf4bd07a2d993d217ac2b17a3503ac41d7befd1016a90511ded5c8ea2d4df7a577bbd1ec3dd994f84c4ea1113
6
+ metadata.gz: 8b509fe042ac69758777e838f245d929807c23ccc3276d1216d0dc127fd54f1758a3474a56469b5c42fb073862431a96bcd85fa78b15979e61272251cfb61237
7
+ data.tar.gz: cb9b1868690d2cd36c9ae2cc50a2cef6962192f072bf5cd70710f9942439d62dbfbb8f6fa67908eddb69853f6a1284840a6502f5daf237864059a716aaf2511e
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ Hoe.spec 'sportdb-readers' do
20
20
  self.licenses = ['Public Domain']
21
21
 
22
22
  self.extra_deps = [
23
- ['sportdb-sync', '>= 1.1.0'],
23
+ ['sportdb-sync', '>= 1.1.1'],
24
24
  ]
25
25
 
26
26
  self.spec_extras = {
@@ -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' => 'br' ## !!! todo/check - br exists?? use pt portuges??
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' ] = mods[ 'uefa.cl' ] = catalog.clubs.build_mods(
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
- rounds.each do |round|
137
- round_rec = Sync::Round.find_or_create( round, event: event_rec ) ## check: use/rename to EventRound why? why not?
138
- end
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|
@@ -6,7 +6,7 @@ module Readers
6
6
 
7
7
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
8
8
  MINOR = 1
9
- PATCH = 1
9
+ PATCH = 2
10
10
  VERSION = [MAJOR,MINOR,PATCH].join('.')
11
11
 
12
12
  def self.version
@@ -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-config/lib' ))
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.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-07-07 00:00:00.000000000 Z
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.0
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.0
26
+ version: 1.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement