lib/sportradar/api/football/ncaafb/drive.rb in sportradar-api-0.11.58 vs lib/sportradar/api/football/ncaafb/drive.rb in sportradar-api-0.11.59
- old
+ new
@@ -29,10 +29,16 @@
mm, ss = duration_seconds.divmod(60)
"#{mm}:#{ss.to_s.rjust(2, '0')}"
end
def end_reason
- plays.reverse_each.detect {|pl| !pl.timeout? && pl.play_type != 'penalty' }&.parsed_ending || 'UNKNOWN' # penalty on TD play, assessed on kickoff
+ ending = plays.reverse_each.detect {|pl| !pl.timeout? && pl.play_type != 'penalty' }&.parsed_ending
+ last_play = plays.reverse_each.detect {|pl| !pl.timeout? }
+ ending ||= if last_play.down == 4 && last_play.yards < last_play.yfd
+ 'Downs'
+ else
+ 'UNKNOWN'
+ end
end
def first_downs
plays.count(&:made_first_down?)
end