Add events started and subbed in player calc

This commit is contained in:
Brian Miyaji
2014-05-02 17:27:11 +10:00
parent ca27eedfbd
commit 6ce1953dc2
2 changed files with 14 additions and 2 deletions

View File

@@ -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

View File

@@ -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