From e210f5cdb4a4625dcf064daed39805ef495d3f03 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 1 May 2014 12:48:31 +1000 Subject: [PATCH] Add metrics to totals before player stat calc --- includes/class-sp-player.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/class-sp-player.php b/includes/class-sp-player.php index fec860da..383aa2aa 100644 --- a/includes/class-sp-player.php +++ b/includes/class-sp-player.php @@ -5,7 +5,7 @@ * The SportsPress player class handles individual player data. * * @class SP_Player - * @version 0.8 + * @version 0.8.1 * @package SportsPress/Classes * @category Class * @author ThemeBoy @@ -52,6 +52,7 @@ class SP_Player extends SP_Custom_Post { public function data( $league_id, $admin = false ) { $seasons = (array)get_the_terms( $this->ID, 'sp_season' ); + $metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true ); $stats = (array)get_post_meta( $this->ID, 'sp_statistics', true ); $leagues = sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id, array() ); @@ -229,6 +230,9 @@ class SP_Player extends SP_Custom_Post { $totals['last5'] = $last5; $totals['last10'] = $last10; + // Add metrics to totals + $totals = array_merge( $metrics, $totals ); + // Generate array of placeholder values for each league $placeholders[ $div_id ] = array(); foreach ( $equations as $key => $value ):