sportdb-readers 2.2.0 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e288d917f0333c7d12ae67eac1c8f16eeb6499cb40b9b4d6e40b45d3e617dc1
4
- data.tar.gz: 1eb4d7e7cbf14e67141edc1043cf64cb2f3bb77fdaf1532f4f7017e95df2adaf
3
+ metadata.gz: b9cd6dabbfbee07274abaffd4ff011043feeb59c3dd0b2f22f8e1ff0c0af5b50
4
+ data.tar.gz: f17cb3e392b861e8a7d41a5066e682976964fb97b6d17d4a18cd6ac4f8197642
5
5
  SHA512:
6
- metadata.gz: 1ad5a423fb07514b374aae88cb7e858446ed75131c1aa9530b4037e521c3a8b3be9b7746cc3a13cb1010e1fa76f002f8b968858145ee593cb53f90eff28e3ef0
7
- data.tar.gz: 19d85196f34037b618d1bbb560cc5f2b42cc4d2d006f60b7428d7bb1d72b4dc770f7c9ae2ac0f86d01eea307d36eb80bf5e4ae0511df8c5f55692c4b306e3f2c
6
+ metadata.gz: 20a4da1af9e2c22bcb2857b4fee74e25e595e05b884329ca3082e7a1577def93e57089d7e2a9790b0d3944730fdce2af7a46f086399d89acee693c5d7677b719
7
+ data.tar.gz: dac7327b7f1f6dac3fd9cd73f1fbf317bbaccd8674f48ef9bfd88fff4da6c824d02528f3a3ff731695a90ab5e500dc0e921113eb8c89ddb78d50d48b306dad55
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 2.2.0
1
+ ### 2.3.0
2
2
 
3
3
  ### 0.0.1 / 2019-10-29
4
4
 
@@ -19,53 +19,74 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
19
19
  end
20
20
 
21
21
 
22
+
22
23
  include Logging
23
24
 
24
25
  def initialize( txt )
25
- @txt = txt
26
+ @errors = []
27
+ @outline = QuickLeagueOutline.parse( txt )
26
28
  end
27
29
 
30
+ attr_reader :errors
31
+ def errors?() @errors.size > 0; end
28
32
 
29
33
 
30
34
  def parse( season: nil )
31
- secs = QuickLeagueOutlineReader.parse( @txt )
32
- ## pp secs
35
+ ## note: every (new) read call - resets errors list to empty
36
+ @errors = []
33
37
 
34
- ########
35
- # step 1 - prepare secs
38
+ ### todo/fix - add back season filter - maybe upstream to outline - why? why not?
39
+ ########
40
+ # step 1 - prepare secs
36
41
  # -- filter seasons if filter present
37
- secs = filter_secs( sec, season: season ) if season
38
-
39
- ## -- check & map; replace inline (string with data struct record)
40
- secs.each do |sec|
41
- sec[:season] = Season.parse( sec[:season ] )
42
- sec[:league] = Import::League.find!( sec[:league] )
43
-
42
+ #
43
+ # secs = filter_secs( sec, season: season ) if season
44
+
45
+
46
+ @outline.each_sec do |sec| ## sec(tion)s
47
+ ### move season parse into outline upstream - why? why not?
48
+ season = Season.parse( sec.season ) ## convert (str) to season obj!!!
49
+ lines = sec.lines
50
+
51
+ ## -- check & map; replace inline (string with data struct record)
52
+
53
+ ####
54
+ ## find leage_rec
55
+
56
+ ## first try by period
57
+ period = Import::LeaguePeriod.find_by( code: sec.league,
58
+ season: season )
59
+ league = if period
60
+ ## find league by qname (assumed to be unique!!)
61
+ ## todo/fix - use League.find_by!( name: ) !!!!
62
+ ## make more specifi
63
+ Import::League.find!( period.qname )
64
+ else
65
+ Import::League.find!( sec.league )
66
+ end
44
67
  ##
45
68
  ## quick hack - assume "Regular" or "Regular Season"
46
69
  ## as default stage (thus, no stage)
47
- if sec[:stage]
48
- sec[:stage] = nil if ['Regular',
49
- 'Regular Season',
50
- 'Regular Stage',
51
- ].include?( sec[:stage] )
52
- end
53
- end
70
+ stage = sec.stage ## check if returns nil or empty string?
71
+
72
+ stage = nil if stage && ['regular',
73
+ 'regular season',
74
+ 'regular stage',
75
+ ].include?( stage.downcase )
54
76
 
55
77
 
56
- ###
57
- # step 2 - handle secs
58
- secs.each do |sec| ## sec(tion)s
59
- season = sec[:season]
60
- league = sec[:league]
61
- stage = sec[:stage]
62
- lines = sec[:lines]
63
-
78
+ ### todo/fix - remove "legacy/old" requirement for start date!!!!
79
+ start = if season.year?
80
+ Date.new( season.start_year, 1, 1 )
81
+ else
82
+ Date.new( season.start_year, 7, 1 )
83
+ end
84
+
64
85
  ### check if event info available - use start_date;
65
86
  ## otherwise we have to guess (use a "synthetic" start_date)
66
- event_info = Import::EventInfo.find_by( season: season,
67
- league: league )
68
-
87
+ ## event_info = Import::EventInfo.find_by( season: season,
88
+ ## league: league )
89
+ =begin
69
90
  start = if event_info && event_info.start_date
70
91
  puts "event info found:"
71
92
  puts " using start date from event: "
@@ -79,13 +100,16 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
79
100
  Date.new( season.start_year, 7, 1 )
80
101
  end
81
102
  end
82
-
103
+ =end
83
104
 
84
105
  parser = MatchParser.new( lines,
85
106
  start ) ## note: keep season start_at date for now (no need for more specific stage date need for now)
86
107
 
87
108
  auto_conf_teams, matches, rounds, groups = parser.parse
88
109
 
110
+ ## auto-add "upstream" errors from parser
111
+ @errors += parser.errors if parser.errors?
112
+
89
113
  puts ">>> #{auto_conf_teams.size} teams:"
90
114
  pp auto_conf_teams
91
115
  puts ">>> #{matches.size} matches:"
@@ -95,6 +119,10 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
95
119
  puts ">>> #{groups.size} groups:"
96
120
  pp groups
97
121
 
122
+ puts "league:"
123
+ pp league
124
+
125
+
98
126
 
99
127
  ##################################
100
128
  ## step 1: map/find teams
@@ -103,9 +131,6 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
103
131
  # puts " [debug] auto_conf_teams:"
104
132
  # pp auto_conf_teams
105
133
 
106
- puts "league:"
107
- pp league
108
-
109
134
  teams = Import::Team.find_by!( name: auto_conf_teams,
110
135
  league: league )
111
136
 
@@ -4,7 +4,7 @@ module SportDb
4
4
  module Module
5
5
  module Readers
6
6
  MAJOR = 2 ## todo: namespace inside version or something - why? why not??
7
- MINOR = 2
7
+ MINOR = 3
8
8
  PATCH = 0
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
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: 2.2.0
4
+ version: 2.3.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: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2025-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-formats
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '4.1'
67
+ version: '4.2'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '4.1'
74
+ version: '4.2'
75
75
  description: sportdb-readers - sport.db readers for leagues, seasons, clubs, match
76
76
  schedules and results, and more
77
77
  email: gerald.bauer@gmail.com
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.4.10
123
+ rubygems_version: 3.5.22
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: sportdb-readers - sport.db readers for leagues, seasons, clubs, match schedules