Fix calculated performance totals missing from array for custom templates

This commit is contained in:
Brian Miyaji
2018-12-09 11:50:07 +11:00
parent 59fc5b4dfb
commit ea19cc4ec9
2 changed files with 3 additions and 2 deletions

View File

@@ -184,7 +184,7 @@ class SP_Event extends SP_Custom_Post{
if ( ! is_array( $players ) ) continue;
foreach ( $players as $player => $player_performance ):
if ( ! is_array( $player_performance ) || ! $player ) continue;
if ( ! is_array( $player_performance ) ) continue;
// Prepare existing values for equation calculation
$vars = $player_performance;

View File

@@ -236,6 +236,7 @@ $i = 0;
if ( $mode == 'icons' ) echo '<td class="sp-performance-icons" colspan="2">';
foreach ( $labels as $key => $label ):
$format = sp_array_value( $formats, $key, 'number' );
if ( 'name' == $key )
continue;
if ( $key == 'position' ):
@@ -243,7 +244,7 @@ $i = 0;
else:
if ( $primary && $key !== $primary ):
$value = '&nbsp;';
elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
elseif ( 'equation' !== $format && array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$value = $row[ $key ];
else:
$value = apply_filters( 'sportspress_event_performance_table_total_value', sp_array_value( $totals, $key, 0 ), $data, $key );