lib/sportradar/api/basketball/game.rb in sportradar-api-0.11.0 vs lib/sportradar/api/basketball/game.rb in sportradar-api-0.11.1
- old
+ new
@@ -195,10 +195,39 @@
def path_summary
"#{ path_base }/summary"
end
# status helpers
+ def realtime_state
+ if future?
+ 'Scheduled'
+ elsif finished?
+ 'Final'
+ elsif postponed?
+ 'Postponed'
+ # elsif halftime?
+ # 'Halftime'
+ else
+ clock_display
+ end
+ end
+
+ def clock_display
+ if clock && period
+ "#{clock} #{period_display}"
+ end
+ end
+ def period_display
+ if period > 5
+ "#{period - 4}OT"
+ elsif period == 5
+ 'OT'
+ else
+ "Q#{period}"
+ end
+ end
+
def postponed?
'postponed' == status
end
def unnecessary?
'unnecessary' == status
@@ -261,10 +290,10 @@
extra_periods = data['overtime'].is_a?(Hash) ? [data['overtime']] : data['overtime']
period_data.concat(extra_periods)
end
set_pbp(period_data)
@pbp = @periods_hash.values
- check_newness(:pbp, plays.last)
+ check_newness(:pbp, plays.last&.updated)
check_newness(:score, @score)
data
end
def get_summary