ahl_scraper 0.3.1 → 0.3.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
  SHA256:
3
- metadata.gz: 285012122b98f5d30bb129fb94766a02405f10217340001caea0627be4422075
4
- data.tar.gz: f52ca819c0d8c6c7882639aa143695f54cd8d4c8c3f8baac9f1ccf58796e0a6e
3
+ metadata.gz: 8fc138bb02a9563b2b9a4940a15dd9bd6e56f56d5b7352bddbb09fb2a63a7c0d
4
+ data.tar.gz: 4292c6ed3cd9c4da7f92aa6b861fa2d40a7cc1c933962c8c55610e34819317f0
5
5
  SHA512:
6
- metadata.gz: 2daa503ec4b26ce5f50979394ca64de5a8b9be4fdb1c9df792ef5746abfcae38fd58613132bdb8de2336643844d8624e12aec70f1b703b5ad9f1dbb5416d8496
7
- data.tar.gz: 8419279fb2c98a65d54b5103052ee54eb9dfc2a7570db1e29decfac10a635af820fbe2ca369664a3bc0585afb221ec8b92dfafd1130892fc066249f228debd5a
6
+ metadata.gz: cc5998864a75a5a351c2f42eb97066340e681024af5da5d766077dc80d581a5c767340aa9b5125d06da1e40cd615e1c7805d86a831b28f5174d3632dd6d6f14f
7
+ data.tar.gz: 8cb1e8fa0b79e50bacf1b4755120f3e41382b8f1b0fb542352af6ea744e62719b2c0b9cb821631c3efa3ffdef1491828742a519023b7eb9d300689f947a526ec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.3.2
4
+
5
+ ## General
6
+
7
+ - Changed `.split` to `&.split` and use `.dig` more to not fail when fields don't exist (often on games that have not finished)
8
+
9
+ ### Game::Goalie
10
+
11
+ - Fix penalty minutes not being copied to the object because of a typo
12
+
3
13
  ## 0.3.1
4
14
 
5
15
  ### Scoreboards
@@ -9,7 +9,9 @@ module AhlScraper
9
9
  end
10
10
 
11
11
  def to_seconds
12
- ice_time = time.split(":")
12
+ return unless time
13
+
14
+ ice_time = time&.split(":")
13
15
  ice_time[0].to_i * 60 + ice_time[1].to_i
14
16
  end
15
17
 
@@ -10,12 +10,16 @@ module AhlScraper
10
10
  end
11
11
 
12
12
  def to_period_seconds
13
- period_time = time.split(":")
13
+ return unless time
14
+
15
+ period_time = time&.split(":")
14
16
  period_time[0].to_i * 60 + period_time[1].to_i
15
17
  end
16
18
 
17
19
  def to_time_elapsed
18
- period_time = time.split(":")
20
+ return unless time
21
+
22
+ period_time = time&.split(":")
19
23
  period_time[0].to_i * 60 + period_time[1].to_i + ((period - 1) * 1200)
20
24
  end
21
25
 
@@ -344,12 +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
- return "postponed" if @raw_data[:details][:status] == "Postponed"
347
+ return "postponed" if @raw_data.dig(:details, :status) == "Postponed"
348
348
  # return "forfeited" if game is a forfeit, need to figure this out if it happens
349
349
 
350
- return "finished" if @raw_data[:details][:final] == "1"
350
+ return "finished" if @raw_data.dig(:details, :final) == "1"
351
351
 
352
- return "in_progress" if @raw_data[:details][:started] == "1"
352
+ return "in_progress" if @raw_data.dig(:details, :started) == "1"
353
353
 
354
354
  "not_started"
355
355
  end
@@ -44,7 +44,7 @@ module AhlScraper
44
44
  goals: @raw_data[:stats][:goals],
45
45
  assists: @raw_data[:stats][:assists],
46
46
  points: @raw_data[:stats][:points],
47
- penalty_minutes: @raw_data[:stats][:penaltyMinute],
47
+ penalty_minutes: @raw_data[:stats][:penaltyMinutes],
48
48
  toi: @raw_data[:stats][:timeOnIce],
49
49
  toi_in_seconds: set_time_on_ice_in_seconds,
50
50
  shots_against: @raw_data[:stats][:shotsAgainst],
@@ -72,11 +72,6 @@ module AhlScraper
72
72
  def period_time
73
73
  @period_time ||= PeriodTimeHelper.new(time, period)
74
74
  end
75
-
76
- def convert_time(game_time)
77
- time = game_time.split(":")
78
- time[0].to_i * 60 + time[1].to_i
79
- end
80
75
  end
81
76
  end
82
77
  end
@@ -51,11 +51,11 @@ module AhlScraper
51
51
  end
52
52
 
53
53
  def city
54
- @city ||= full_name.split.length > 2 ? exception_split_object&.dig(:city) : full_name.split[0]
54
+ @city ||= full_name&.split.length > 2 ? exception_split_object&.dig(:city) : full_name&.split[0]
55
55
  end
56
56
 
57
57
  def name
58
- @name ||= full_name.split.length > 2 ? exception_split_object&.dig(:name) : full_name.split[1]
58
+ @name ||= full_name&.split.length > 2 ? exception_split_object&.dig(:name) : full_name&.split[1]
59
59
  end
60
60
 
61
61
  def game_file_city
@@ -17,14 +17,9 @@ module AhlScraper
17
17
 
18
18
  def ordered_penalty_shots
19
19
  @ordered_penalty_shots ||= penalty_shot_data.sort do |a, b|
20
- [a[:period][:id].to_i, convert_time(a[:time])] <=> [b[:period][:id].to_i, convert_time(b[:time])]
20
+ [a[:period][:id].to_i, IceTimeHelper.new(a[:time]).to_sec] <=> [b[:period][:id].to_i, IceTimeHelper.new(b[:time]).to_sec]
21
21
  end
22
22
  end
23
-
24
- def convert_time(game_time)
25
- time = game_time.split(":")
26
- time[0].to_i * 60 + time[1].to_i
27
- end
28
23
  end
29
24
  end
30
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AhlScraper
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
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.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jefftcraig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-07 00:00:00.000000000 Z
11
+ date: 2022-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json