Increment events played in player list only when starting lineup or substitution made
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user