Fix single player stats for multiple divisions

This commit is contained in:
ThemeBoy
2013-12-02 17:59:45 +11:00
parent e715dd2435
commit 28a1d8d844

View File

@@ -45,13 +45,6 @@ function sp_player_stats_meta( $post ) {
// Get labels from metric variables // Get labels from metric variables
$metric_labels = (array)sp_get_var_labels( 'sp_metric' ); $metric_labels = (array)sp_get_var_labels( 'sp_metric' );
$totals = array( 'eventsattended' => 0, 'eventsplayed' => 0 );
$placeholders = array();
foreach ( $metric_labels as $key => $value ):
$totals[ $key ] = 0;
endforeach;
// Generate array of all division ids // Generate array of all division ids
$div_ids = array(); $div_ids = array();
foreach ( $divisions as $key => $value ): foreach ( $divisions as $key => $value ):
@@ -66,6 +59,9 @@ function sp_player_stats_meta( $post ) {
return; return;
endif; endif;
// Initialize placeholders array
$placeholders = array();
// Loop through statistics for each team // Loop through statistics for each team
foreach ( $team_ids as $team_id ): foreach ( $team_ids as $team_id ):
if ( !$team_id ) continue; if ( !$team_id ) continue;
@@ -77,6 +73,13 @@ function sp_player_stats_meta( $post ) {
$equations = sp_get_var_equations( 'sp_metric' ); $equations = sp_get_var_equations( 'sp_metric' );
foreach ( $div_ids as $div_id ): foreach ( $div_ids as $div_id ):
$totals = array( 'eventsattended' => 0, 'eventsplayed' => 0 );
foreach ( $metric_labels as $key => $value ):
$totals[ $key ] = 0;
endforeach;
$args = array( $args = array(
'post_type' => 'sp_event', 'post_type' => 'sp_event',
'numberposts' => -1, 'numberposts' => -1,