sportdb-catalogs 1.2.2 → 1.2.3

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: '09d5c1b4a2fea093abfc294ccbf6149315a335a07a5e934d25fb652215e0ab23'
4
- data.tar.gz: 991f6cd9ee018fa4f7d84be847c5868a024ac240ec5d29cb60636addbd1984c5
3
+ metadata.gz: 8b593473df2d17fc60175c907bf78b0794f3bc26a6234cc247d58e788f8850ec
4
+ data.tar.gz: 0a9f535f23da1d3da21173d1c7d7588188e287b299c448f47bb8fa0cf9e33aa7
5
5
  SHA512:
6
- metadata.gz: ffaca4423b4dc8adba0db61187dfcf2cc0b1fb5c47255953ed08e8e13bc1a0e2967673d7f1a60f5d6a7045b93ff3575fc27114ed86be15c27f72041287e59a91
7
- data.tar.gz: ded797ffeae2ce160c1d6477416fa90d8b26433e78aca4bdc61c82bf0bdf8eef95f346c2f2fe95e070be962d8789d511d222379057245a9d649388b0a40d93c1
6
+ metadata.gz: 927b572cef955abbc720ce43b4fab2cff7ac3f1eaae1514069302421d4172dcb96d3b02e96d36141a900f19e12efe1a820e44881e9a43ad3eeae983c8166f060
7
+ data.tar.gz: 7058a7524a1381e28b46586db1fd0b93d35ebbd807d2b75a20b2ef6071bdf738ad3db0bb3f142c83632c0b4203c42da314e6e7b6bfbcfcbf9741c7ab3f89083d
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 1.2.2
1
+ ### 1.2.3
2
2
  ### 0.0.1 / 2019-06-29
3
3
 
4
4
  * Everything is new. First release.
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ Hoe.spec 'sportdb-catalogs' do
22
22
  self.extra_deps = [
23
23
  ['sportdb-structs', '>= 0.3.1'],
24
24
  ['sqlite3'], ## add sqlite for "metal" use (no activerecord etc.)
25
- ['footballdb-data'] ## add builtin default db
25
+ ['footballdb-data', '>= 2024.8.23'] ## add builtin default db
26
26
  ]
27
27
 
28
28
  self.spec_extras = {
@@ -155,6 +155,29 @@ def self._city( city )
155
155
  city ## (re)use city struct - no need to run lookup again
156
156
  end
157
157
  end
158
+
159
+
160
+ def self._league( league )
161
+ if league.is_a?( String ) || league.is_a?( Symbol )
162
+ # note: query/find country via catalog db
163
+ ## only query by code - why? why not?
164
+ recs = League.match_by_name_or_code( league )
165
+ if recs.empty?
166
+ puts "** !!! ERROR !!! - unknown league >#{league}< - no match found, sorry"
167
+ exit 1
168
+ elsif recs.size > 1
169
+ puts "** !!! ERROR !!! - league >#{league}< - too many matches found (#{recs.size}), sorry"
170
+ pp recs
171
+ exit 1
172
+ end
173
+ recs[0]
174
+ else ## assume league struct
175
+ league ## (re)use league struct - no need to run lookup again
176
+ end
177
+ end
178
+
179
+
180
+
158
181
  end # class Record
159
182
 
160
183
 
@@ -16,7 +16,10 @@ class EventInfo < Record
16
16
  def self._build_event_info( row )
17
17
  ## note: cache structs by key (do NOT rebuild duplicates; reuse)
18
18
  @cache ||= Hash.new
19
- @cache[ row[0] ] ||= Sports::EventInfo.new(
19
+ ## note cache key MUST be unique!
20
+ ## use league PLUS season (row[0] season only will NOT work)
21
+ key = "#{row[0]}_#{row[1]}"
22
+ @cache[ key ] ||= Sports::EventInfo.new(
20
23
  league: _to_league( row[0] ),
21
24
  season: Season.parse(row[1]),
22
25
  teams: row[2],
@@ -29,8 +32,7 @@ class EventInfo < Record
29
32
 
30
33
 
31
34
  def self.seasons( league )
32
- league_key = league.is_a?( String ) ? League.find!( league ).key
33
- : league.key
35
+ league_key = _league( league ).key
34
36
 
35
37
  rows = execute( <<-SQL )
36
38
  SELECT #{self.columns.join(', ')}
@@ -43,8 +45,7 @@ SQL
43
45
 
44
46
 
45
47
  def self.find_by( league:, season: )
46
- league_key = league.is_a?( String ) ? League.find!( league ).key
47
- : league.key
48
+ league_key = _league( league ).key
48
49
  season_key = season.is_a?( String ) ? Season.parse(season).key
49
50
  : season.key
50
51
 
@@ -5,7 +5,7 @@ module Catalogs
5
5
 
6
6
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
7
7
  MINOR = 2
8
- PATCH = 2
8
+ PATCH = 3
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
11
11
  def self.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-catalogs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2024-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-structs
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 2024.8.23
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 2024.8.23
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rdoc
57
57
  requirement: !ruby/object:Gem::Requirement