From 7e5e2a9070f3aaf97651da1384107571b6b18aa3 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 13 Feb 2014 17:17:57 +1100 Subject: [PATCH] Only count events as played when starting lineup or made substitution --- functions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 480b77d0..0d614806 100644 --- a/functions.php +++ b/functions.php @@ -2176,7 +2176,6 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) { foreach( $events as $event ): $totals['eventsattended']++; - $totals['eventsplayed']++; $team_statistics = (array)get_post_meta( $event->ID, 'sp_players', true ); // Add all team statistics @@ -2185,8 +2184,11 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) { // $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 ) ): + $totals['eventsplayed']++; + endif; foreach ( $player_statistics as $key => $value ): - array_key_exists( $key, $totals ) ): + if ( array_key_exists( $key, $totals ) ): $totals[ $key ] += $value; endif; endforeach;