diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php index 73b9037d..4c640341 100644 --- a/includes/class-sp-player-list.php +++ b/includes/class-sp-player-list.php @@ -71,7 +71,7 @@ class SP_Player_List extends SP_Custom_Post { endforeach; // Initialize player totals - $totals[ $player_id ] = array( 'eventsattended' => 0, 'eventsplayed' => 0, 'streak' => 0 ); + $totals[ $player_id ] = array( 'eventsattended' => 0, 'eventsplayed' => 0, 'eventsstarted' => 0, 'eventssubbed' => 0, 'streak' => 0 ); foreach ( $performance_labels as $key => $value ): $totals[ $player_id ][ $key ] = 0; @@ -149,6 +149,12 @@ class SP_Player_List extends SP_Custom_Post { if ( sp_array_value( $player_performance, 'status' ) != 'sub' || sp_array_value( $player_performance, 'sub', 0 ) ): $totals[ $player_id ]['eventsplayed']++; + if ( sp_array_value( $player_performance, 'status' ) == 'lineup' ): + $totals[ $player_id ]['eventsstarted']++; + elseif ( sp_array_value( $player_performance, 'status' ) == 'sub' && sp_array_value( $player_performance, 'sub', 0 ) ): + $totals[ $player_id ]['eventssubbed']++; + endif; + $value = $team_results['outcome']; // Convert to array diff --git a/includes/class-sp-player.php b/includes/class-sp-player.php index 59453756..56e55758 100644 --- a/includes/class-sp-player.php +++ b/includes/class-sp-player.php @@ -85,7 +85,7 @@ class SP_Player extends SP_Custom_Post { foreach ( $div_ids as $div_id ): - $totals = array( 'eventsattended' => 0, 'eventsplayed' => 0, 'streak' => 0, 'last5' => null, 'last10' => null ); + $totals = array( 'eventsattended' => 0, 'eventsplayed' => 0, 'eventsstarted' => 0, 'eventssubbed' => 0, 'streak' => 0, 'last5' => null, 'last10' => null ); foreach ( $performance_labels as $key => $value ): $totals[ $key ] = 0; @@ -170,6 +170,12 @@ class SP_Player extends SP_Custom_Post { if ( sp_array_value( $player_performance, 'status' ) != 'sub' || sp_array_value( $player_performance, 'sub', 0 ) ): $totals['eventsplayed']++; + if ( sp_array_value( $player_performance, 'status' ) == 'lineup' ): + $totals['eventsstarted']++; + elseif ( sp_array_value( $player_performance, 'status' ) == 'sub' && sp_array_value( $player_performance, 'sub', 0 ) ): + $totals['eventssubbed']++; + endif; + $value = $team_results['outcome']; // Convert to array