Also use performance in player lists
This commit is contained in:
@@ -226,8 +226,10 @@ class SP_Player_List extends SP_Custom_Post {
|
|||||||
$totals[ $player_id ]['last10'] = $last10;
|
$totals[ $player_id ]['last10'] = $last10;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
|
$placeholders[ $player_id ] = array_merge( $totals[ $player_id ], $placeholders[ $player_id ] );
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => array( 'sp_metric', 'sp_statistic' ),
|
'post_type' => array( 'sp_performance', 'sp_metric', 'sp_statistic' ),
|
||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
'posts_per_page' => -1,
|
'posts_per_page' => -1,
|
||||||
'orderby' => 'menu_order',
|
'orderby' => 'menu_order',
|
||||||
@@ -256,6 +258,8 @@ class SP_Player_List extends SP_Custom_Post {
|
|||||||
if ( ! $player_id )
|
if ( ! $player_id )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
$variables = array_merge( sp_array_value( $totals, $player_id, array() ), array_filter( sp_array_value( $placeholders, $player_id, array() ) ) );
|
||||||
|
|
||||||
foreach ( $stats as $stat ):
|
foreach ( $stats as $stat ):
|
||||||
if ( sp_array_value( $placeholders[ $player_id ], $stat->post_name, '' ) == '' ):
|
if ( sp_array_value( $placeholders[ $player_id ], $stat->post_name, '' ) == '' ):
|
||||||
|
|
||||||
@@ -266,7 +270,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|||||||
endif;
|
endif;
|
||||||
else:
|
else:
|
||||||
// Solve
|
// Solve
|
||||||
$placeholder = sp_solve( $stat->equation, sp_array_value( $totals, $player_id, array() ), $stat->precision );
|
$placeholder = sp_solve( $stat->equation, $variables, $stat->precision );
|
||||||
|
|
||||||
// Adjustments
|
// Adjustments
|
||||||
$placeholder += sp_array_value( sp_array_value( $adjustments, $player_id, array() ), $stat->post_name, 0 );
|
$placeholder += sp_array_value( sp_array_value( $adjustments, $player_id, array() ), $stat->post_name, 0 );
|
||||||
@@ -275,6 +279,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|||||||
$placeholders[ $player_id ][ $stat->post_name ] = $placeholder;
|
$placeholders[ $player_id ][ $stat->post_name ] = $placeholder;
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
// Merge the data and placeholders arrays
|
// Merge the data and placeholders arrays
|
||||||
|
|||||||
Reference in New Issue
Block a user