From 3a1d86a96989a00352fae9ca9aef66b217037515 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 13 Feb 2014 17:22:34 +1100 Subject: [PATCH] Increment events played in player list only when starting lineup or substitution made --- functions.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/functions.php b/functions.php index 0d614806..1a902c92 100644 --- a/functions.php +++ b/functions.php @@ -1888,7 +1888,9 @@ if ( !function_exists( 'sportspress_get_player_list_data' ) ) { continue; // Increment events played - $totals[ $player_id ]['eventsplayed']++; + if ( sportspress_array_value( $player_statistics, 'status' ) != 'sub' || sportspress_array_value( $player_statistics, 'sub', 0 ) ): + $totals[ $player_id ]['eventsplayed']++; + endif; foreach ( $player_statistics as $key => $value ): @@ -1910,7 +1912,9 @@ if ( !function_exists( 'sportspress_get_player_list_data' ) ) { continue; // Increment events played - $totals[ $player_id ]['eventsplayed']++; + if ( sportspress_array_value( $player_statistics, 'status' ) != 'sub' || sportspress_array_value( $player_statistics, 'sub', 0 ) ): + $totals[ $player_id ]['eventsplayed']++; + endif; foreach ( $player_statistics as $key => $value ): @@ -2148,11 +2152,6 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) { 'numberposts' => -1, 'posts_per_page' => -1, 'meta_query' => array( -// 'relation' => 'AND', -// array( -// 'key' => 'sp_team', -// 'value' => $team_id -// ), array( 'key' => 'sp_player', 'value' => $post_id @@ -2179,9 +2178,7 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) { $team_statistics = (array)get_post_meta( $event->ID, 'sp_players', true ); // Add all team statistics -// if ( array_key_exists( $team_id, $team_statistics ) ): foreach ( $team_statistics as $players ): -// $players = sportspress_array_value( $team_statistics, $team_id, array() ); if ( array_key_exists( $post_id, $players ) ): $player_statistics = sportspress_array_value( $players, $post_id, array() ); if ( sportspress_array_value( $player_statistics, 'status' ) != 'sub' || sportspress_array_value( $player_statistics, 'sub', 0 ) ): @@ -2193,7 +2190,6 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) { endif; endforeach; endif; -// endif; endforeach; endforeach;