Fix empty timeline error when calculating substitution time
This commit is contained in:
@@ -327,6 +327,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|||||||
else:
|
else:
|
||||||
foreach ( $timeline as $timeline_team => $timeline_players ):
|
foreach ( $timeline as $timeline_team => $timeline_players ):
|
||||||
foreach ( $timeline_players as $timeline_player => $timeline_performance ):
|
foreach ( $timeline_players as $timeline_player => $timeline_performance ):
|
||||||
|
if ( ! is_array( $timeline_performance ) ) continue;
|
||||||
if ( 'sub' === sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'status' ) && $player_id === (int) sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'sub', 0 ) ):
|
if ( 'sub' === sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'status' ) && $player_id === (int) sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'sub', 0 ) ):
|
||||||
$substitution_time = sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $timeline_player ), 'sub' ), 0, 0 );
|
$substitution_time = sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $timeline_player ), 'sub' ), 0, 0 );
|
||||||
if ( $substitution_time ):
|
if ( $substitution_time ):
|
||||||
|
|||||||
@@ -411,6 +411,7 @@ class SP_Player extends SP_Custom_Post {
|
|||||||
$totals['eventminutes'] -= sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $this->ID ), 'sub' ), 0, 0 );
|
$totals['eventminutes'] -= sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $this->ID ), 'sub' ), 0, 0 );
|
||||||
else:
|
else:
|
||||||
foreach ( $timeline as $timeline_team => $timeline_players ):
|
foreach ( $timeline as $timeline_team => $timeline_players ):
|
||||||
|
if ( ! is_array( $timeline_players ) ) continue;
|
||||||
foreach ( $timeline_players as $timeline_player => $timeline_performance ):
|
foreach ( $timeline_players as $timeline_player => $timeline_performance ):
|
||||||
if ( 'sub' === sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'status' ) && $this->ID === (int) sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'sub', 0 ) ):
|
if ( 'sub' === sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'status' ) && $this->ID === (int) sp_array_value( sp_array_value( $players, $timeline_player, array() ), 'sub', 0 ) ):
|
||||||
$substitution_time = sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $timeline_player ), 'sub' ), 0, 0 );
|
$substitution_time = sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $timeline_player ), 'sub' ), 0, 0 );
|
||||||
|
|||||||
Reference in New Issue
Block a user