From 2fd18e1593b63f587e31e1046f494599add66b8d Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 29 Apr 2014 19:06:08 +1000 Subject: [PATCH] Also use performance in player lists --- includes/class-sp-player-list.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php index 2c1a6baa..7d521713 100644 --- a/includes/class-sp-player-list.php +++ b/includes/class-sp-player-list.php @@ -226,8 +226,10 @@ class SP_Player_List extends SP_Custom_Post { $totals[ $player_id ]['last10'] = $last10; endforeach; + $placeholders[ $player_id ] = array_merge( $totals[ $player_id ], $placeholders[ $player_id ] ); + $args = array( - 'post_type' => array( 'sp_metric', 'sp_statistic' ), + 'post_type' => array( 'sp_performance', 'sp_metric', 'sp_statistic' ), 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', @@ -256,6 +258,8 @@ class SP_Player_List extends SP_Custom_Post { if ( ! $player_id ) continue; + $variables = array_merge( sp_array_value( $totals, $player_id, array() ), array_filter( sp_array_value( $placeholders, $player_id, array() ) ) ); + foreach ( $stats as $stat ): if ( sp_array_value( $placeholders[ $player_id ], $stat->post_name, '' ) == '' ): @@ -266,7 +270,7 @@ class SP_Player_List extends SP_Custom_Post { endif; else: // Solve - $placeholder = sp_solve( $stat->equation, sp_array_value( $totals, $player_id, array() ), $stat->precision ); + $placeholder = sp_solve( $stat->equation, $variables, $stat->precision ); // Adjustments $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; endif; endforeach; + endforeach; // Merge the data and placeholders arrays