Branch Coverage

blib/lib/Sport/Analytics/NHL/Normalizer.pm
Criterion Covered Total %
branch 87 132 65.9


line true false branch
302 19 0 if ($event->{'player1'})
303 1 18 if ($$positions{$event->{'player1'}} eq 'G') { }
314 19 0 if ($event->{'player2'})
316 18 1 if $event->{'ts'}
319 3 16 if $no_stats
330 4 66 if ($event->{'servedby'}) { }
0 66 elsif ($event->{'_servedby'}) { }
339 2 68 if $no_stats
347 1 0 unless $event->{'sources'}{'PL'} or $event->{'sources'}{'BS'}
348 196 531 if ($event->{'type'} eq 'FAC')
368 0 978 if ($event->{'so'})
369 0 0 if $event->{'type'} eq 'GOAL'
370 0 0 unless $event->{'type'} eq 'PENL'
382 0 4 if ($so->[0] or $so->[1])
383 0 0 if $so->[0] == $so->[1]
384 0 0 $so->[0] > $so->[1] ? :
385 0 0 $so->[0] > $so->[1] ? :
394 15 162 unless $key =~ /^\d{7}$/
405 0 9 if ($game->{'teams'}[0]{'score'} == $game->{'teams'}[1]{'score'}) { }
0 9 elsif ($game->{'teams'}[0]{'score'} > $game->{'teams'}[1]{'score'}) { }
409 0 0 $game->{'ot'} && $game->{'season'} >= 1999 ? :
412 0 9 $game->{'ot'} && $game->{'season'} >= 1999 ? :
420 3 2 if ($game->{'location'})
451 220 25 unless $player->{'_id'} =~ /^80/ or not $player->{'shifts'} and grep {$player->{'_id'} eq $_;} @{$$team{'scratches'};}
464 760 120 if defined $player->{$toi} and $player->{$toi} =~ /\:/
466 12 208 if ($player->{'position'} eq 'G') { }
472 40 180 if (not defined $player->{'faceoffTaken'} or $player->{'faceoffTaken'} eq -1)
485 0 0 $player->{'faceoffTaken'} ? :
521 1581 35 unless not $event->{'location'} and &is_noplay_event($event)
524 0 1616 if ($event->{'ts'} > $event->{'period'} * 1200)
534 13372 1172 if defined $event->{$field}
536 0 1616 if defined $event->{'penaltyshot'}
544 621 280 if (not $event->{'team2'} and defined $event->{'t'} and $event->{'t'} != -1)
548 3232 4848 if ($field =~ /assist(\d)/)
550 0 50 if ($event->{$field} and $event->{$field} =~ /\D/ and not $event->{'assists'}[$as - 1] =~ /\D/)
554 2468 5612 if exists $event->{$field}
561 0 240 if (&is_noplay_event($event) and !($event->{'on_ice'} && @{$event->{'on_ice'};}) || @{$event->{'on_ice'};} != 2 || !$event->{'on_ice'}[0] || !$event->{'on_ice'}[1])
567 1555 0 if ($event->{'on_ice'} and @{$event->{'on_ice'};} and @{$event->{'on_ice'}[0];} and @{$event->{'on_ice'}[1];})
571 17960 0 if /\d/
575 1555 21 if ($event->{'on_ice'} and @{$event->{'on_ice'};} and @{$event->{'on_ice'}[0];} and @{$event->{'on_ice'}[1];}) { }
595 30 1 if ($event->{'assist1'})
598 30 1 if ($event->{'assist2'})
603 0 0 if (not $event->{'player2'} and $event->{'on_ice'} and @{$event->{'on_ice'};})
605 0 0 if ${$$PLAYER_IDS{$o};}->{'position'} eq 'G'
615 6 110 if defined $event->{'servedby'}
616 0 116 if ($event->{'penalty'} =~ /PS\s+\-\s+(\S.*)/)
622 0 116 if $event->{'servedby'} and $event->{'servedby'} =~ /^80/
634 1590 26 if ($event->{'type'} ne 'GOAL')
638 470 960 if ($event->{'type'} eq 'MISS' or $event->{'type'} eq 'GOAL' or $event->{'type'} eq 'SHOT' or $event->{'type'} eq 'BLOCK')
644 0 1056 if ($event->{'player2'} and not $event->{'player2'} =~ /^80/ and defined $Sport::Analytics::NHL::Normalizer::REVERSE_STAT{$event->{'player2'}})
650 2 33783 unless (defined $event->{$field})
654 5064 28719 if $field eq 'file' or ref $event->{$field}
655 16351 12368 if ($event->{$field} =~ /^\d+$/) { }
671 0 1297 if ($event->{'period'} == 4 and $gp < 4)
672 0 0 if ($event->{'time'} eq '0:00') { }
728 7 2 if ($p <= 3 or not $is_last and $event->{'stage'} != $Sport::Analytics::NHL::Normalizer::REGULAR) { }
1 1 elsif ($is_last) { }
739 0 1 $event->{'season'} < 1942 ? :
740 0 1 $event->{'season'} < 1942 ? :
761 0 342 unless $Sport::Analytics::NHL::Normalizer::a->{'period'} <=> $Sport::Analytics::NHL::Normalizer::b->{'period'} or $Sport::Analytics::NHL::Normalizer::a->{'ts'} <=> $Sport::Analytics::NHL::Normalizer::b->{'ts'} or $EVENT_PRECEDENCE{$Sport::Analytics::NHL::Normalizer::a->{'type'}} <=> $EVENT_PRECEDENCE{$Sport::Analytics::NHL::Normalizer::b->{'type'}} or $Sport::Analytics::NHL::Normalizer::a->{'type'} cmp $Sport::Analytics::NHL::Normalizer::b->{'type'}
766 0 5 $#events_by_period > 3 ? :
767 0 5 if $periods < scalar @{$gp;}
771 6 9 unless $period->[0] and $period->[0]{'type'} eq 'PSTR'
773 6 9 unless $period->[0] and $period->[-1]{'type'} eq 'PEND'
779 0 1008 $_->{'type'} eq 'PSTR' && $e > 0 || $_->{'type'} eq 'PEND' && $e < $#{$period;} ? :
809 1 2 unless ($no_summarize)