lib/sportradar/api/football/ncaafb/drive.rb in sportradar-api-0.11.46 vs lib/sportradar/api/football/ncaafb/drive.rb in sportradar-api-0.11.47

- old
+ new

@@ -29,18 +29,18 @@ mm, ss = duration_seconds.divmod(60) "#{mm}:#{ss.to_s.rjust(2, '0')}" end def end_reason - plays.last.parsed_ending || 'UNKNOWN' + plays.reverse_each.detect {|pl| !pl.timeout? && pl.play_type != 'penalty' }&.parsed_ending || 'UNKNOWN' # penalty on TD play, assessed on kickoff end def first_downs plays.count(&:made_first_down?) end def over? - plays.last&.parsed_ending || (overtime? && ['End of Quarter', 'End of Game'].include?(plays.last&.description)) + (end_reason != 'UNKNOWN') || (overtime? && ['End of Quarter', 'End of Game'].include?(plays.last&.description)) end def handle_plays_and_events(data, **opts) create_data(@plays_hash, data['actions'], klass: Play, api: api, drive: self) if data['actions'] create_data(@events_hash, data['events'], klass: Event, api: api, drive: self) if data['events']