ahl_scraper 0.3.5 → 0.3.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 361ba81452b6f5f3ea306d74730190b602b058636e75c99a803c1873afb3f0d7
|
4
|
+
data.tar.gz: 1fea9a929d692523c9dde5f4bd243a6e9bf7bfff0ff38d7173534c199d0b03fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a41ddd6414132e4c5e825854a1a45042dceab56fba3db9d853387de3630514062c5b059f353ae100e8ef738fb1163b61ef20e1ea1555c537998910d5b6d74237
|
7
|
+
data.tar.gz: dc54c30d399a754adfd755a6a83f519dd9ddf602f6281e74411be5c5821f370c137535aea987d9166dc65ddf71148499b00c15a26645dac107ee3db07365cf1a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.3.6
|
4
|
+
|
5
|
+
### Game
|
6
|
+
- Add `suspended` game status
|
7
|
+
|
8
|
+
### PlayoffBrackets::Round
|
9
|
+
|
10
|
+
- Add `started?` for when round has started (even if it is finished)
|
11
|
+
- Add `active?` for when round has active series
|
12
|
+
- Add `finished?` for when round has started and has no active series
|
13
|
+
|
14
|
+
### PlayoffBrackets::Series
|
15
|
+
|
16
|
+
- Fix `active?` to properly assess `active: "1"` meaning has started but not necessarily currently active
|
17
|
+
- Added `started?` which now uses `active: "1"` to determine if the series has started
|
18
|
+
- Set round one series win count needed to `2` for season `76`
|
19
|
+
|
3
20
|
## 0.3.5
|
4
21
|
|
5
22
|
### Developer
|
data/Gemfile.lock
CHANGED
@@ -344,7 +344,12 @@ module AhlScraper
|
|
344
344
|
irregular_game_status = IRREGULAR_GAMES.dig(game_id.to_s, :status)
|
345
345
|
return irregular_game_status if irregular_game_status
|
346
346
|
|
347
|
-
|
347
|
+
game_status = @raw_data.dig(:details, :status)
|
348
|
+
|
349
|
+
return "suspended" unless game_status.match(/Suspended/).nil?
|
350
|
+
|
351
|
+
return "postponed" if game_status == "Postponed"
|
352
|
+
|
348
353
|
# return "forfeited" if game is a forfeit, need to figure this out if it happens
|
349
354
|
|
350
355
|
return "finished" if @raw_data.dig(:details, :final) == "1"
|
@@ -23,13 +23,23 @@ module AhlScraper
|
|
23
23
|
@round_type_name ||= @raw_data[:round_type_name]
|
24
24
|
end
|
25
25
|
|
26
|
+
def series
|
27
|
+
@series ||= @raw_data[:matchups].map { |series| Series.new(series, { bracket_data: @opts[:bracket_data] }) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def started?
|
31
|
+
@started = active? || finished? if @started.nil?
|
32
|
+
@started
|
33
|
+
end
|
34
|
+
|
26
35
|
def active?
|
27
|
-
@active = series.
|
36
|
+
@active = series.map(&:active?).any?(true) if @active.nil?
|
28
37
|
@active
|
29
38
|
end
|
30
39
|
|
31
|
-
def
|
32
|
-
@
|
40
|
+
def finished?
|
41
|
+
@finished = series.map(&:finished?).none?(false) && !active? if @finished.nil?
|
42
|
+
@finished
|
33
43
|
end
|
34
44
|
end
|
35
45
|
end
|
@@ -13,7 +13,7 @@ module AhlScraper
|
|
13
13
|
"7" => { "1" => 4 },
|
14
14
|
"69" => { "1" => 4 },
|
15
15
|
"72" => { "1" => 1, "2" => 1, "3" => 2, "4" => 2 },
|
16
|
-
"76" => { "1" =>
|
16
|
+
"76" => { "1" => 2, "2" => 3, "3" => 4, "4" => 4, "5" => 4 },
|
17
17
|
}.freeze
|
18
18
|
|
19
19
|
def id
|
@@ -24,6 +24,10 @@ module AhlScraper
|
|
24
24
|
@name ||= @raw_data[:series_name]
|
25
25
|
end
|
26
26
|
|
27
|
+
def season_id
|
28
|
+
@season_id ||= find_season_id
|
29
|
+
end
|
30
|
+
|
27
31
|
def logo_url
|
28
32
|
@logo_url ||= @raw_data[:series_logo]
|
29
33
|
end
|
@@ -32,8 +36,14 @@ module AhlScraper
|
|
32
36
|
@round ||= @raw_data[:round].to_i
|
33
37
|
end
|
34
38
|
|
39
|
+
def started?
|
40
|
+
@started = @raw_data[:active] == "1" if @started.nil?
|
41
|
+
@started
|
42
|
+
end
|
43
|
+
|
35
44
|
def active?
|
36
|
-
@active ||=
|
45
|
+
@active ||= team_ids_present? && team1_wins < wins_needed && team2_wins < wins_needed if @active.nil?
|
46
|
+
@active
|
37
47
|
end
|
38
48
|
|
39
49
|
def home_feeder_series
|
@@ -75,11 +85,24 @@ module AhlScraper
|
|
75
85
|
end
|
76
86
|
|
77
87
|
def wins_needed
|
78
|
-
@wins_needed ||= OVERRIDE_WINS_NEEDED.dig(season_id, round.to_s) || (round == 1 ? 3 : 4)
|
88
|
+
@wins_needed ||= OVERRIDE_WINS_NEEDED.dig(season_id.to_s, round.to_s) || (round == 1 ? 3 : 4)
|
89
|
+
end
|
90
|
+
|
91
|
+
def finished?
|
92
|
+
@finished = winning_team_id.present? if @finished.nil?
|
93
|
+
@finished
|
79
94
|
end
|
80
95
|
|
81
96
|
private
|
82
97
|
|
98
|
+
def find_season_id
|
99
|
+
dig_season_id = @opts.dig(:bracket_data, :rounds, round - 1, :season_id)
|
100
|
+
|
101
|
+
return if dig_season_id.nil? || dig_season_id.empty?
|
102
|
+
|
103
|
+
dig_season_id.to_i
|
104
|
+
end
|
105
|
+
|
83
106
|
def first_game
|
84
107
|
@first_game ||= @raw_data.dig(:games, 0)
|
85
108
|
end
|
@@ -92,10 +115,6 @@ module AhlScraper
|
|
92
115
|
nil
|
93
116
|
end
|
94
117
|
|
95
|
-
def season_id
|
96
|
-
@opts.dig(:bracket_data, :rounds, round - 1, :season_id)
|
97
|
-
end
|
98
|
-
|
99
118
|
def team1
|
100
119
|
@team1 ||= @raw_data[:team1].to_i.zero? ? nil : @raw_data[:team1].to_i
|
101
120
|
end
|
@@ -105,7 +124,7 @@ module AhlScraper
|
|
105
124
|
end
|
106
125
|
|
107
126
|
def team_ids_present?
|
108
|
-
team1 && team2
|
127
|
+
!team1.nil? && !team2.nil?
|
109
128
|
end
|
110
129
|
|
111
130
|
def team1_wins
|
data/lib/ahl_scraper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahl_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jefftcraig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|