From d0d07e79be17b770f28cb56588180395cbcabaf2 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 29 Apr 2014 21:09:23 +1000 Subject: [PATCH] Fix equation solving and player numbers in list --- assets/fonts/sportspress.eot | Bin 3888 -> 3888 bytes assets/fonts/sportspress.ttf | Bin 3708 -> 3708 bytes assets/fonts/sportspress.woff | Bin 3116 -> 3116 bytes includes/class-sp-player-list.php | 19 +++++++++++++------ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/assets/fonts/sportspress.eot b/assets/fonts/sportspress.eot index 4f9da2f57786e649dd280392743386f4e9166cb4..fc2f4e45d0d904333734087536897f79c0f9d113 100755 GIT binary patch delta 54 zcmdlWw?S@#Ez`lp6YY;Ni%d`3%)xk*TY7P#Q9QrRR|ak-1`s&ksvQWUH~--=VFCd2 CYY?aa delta 54 zcmdlWw?S@#EmO_XiT1~sg?B#N%)xk*TY9OCQ9QrRR|ak-1`s&kvS%WU-u#Ehgb4r% C6%u0r diff --git a/assets/fonts/sportspress.ttf b/assets/fonts/sportspress.ttf index 90644ea70fcd499746a053f6cb809108e8cd831e..cc9977a0c37c966109a2779e849b31df293f8245 100755 GIT binary patch delta 47 ucmew(^G9YvAhXEyw2dJ*xuq8;8pZS5d}ZKfVgP~jt=fSwdb04TlP$Z(VIPZOqc+msSoD> diff --git a/assets/fonts/sportspress.woff b/assets/fonts/sportspress.woff index a9c09b255c7c3e7d6f5d8cae0aa6a5c10b4849df..9b9a77e407c8045d714c5af35d6cee84c8f32308 100755 GIT binary patch delta 47 ucmZ1@u|{G-FSE$>w2c#5Ii(jLY>Vf&`O3h}!~g>4TeSmW^kxIDKa2o=VGhIq delta 47 vcmZ1@u|{G-FSGE@XB#K9a!N0)X^ZE#`O3h}!~g>4TlP$Z(VGpp{xAXnpQ;eT diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php index 0e5efdc9..1f69ffe0 100644 --- a/includes/class-sp-player-list.php +++ b/includes/class-sp-player-list.php @@ -191,6 +191,7 @@ class SP_Player_List extends SP_Custom_Post { endif; endforeach; + endforeach; endforeach; @@ -246,7 +247,13 @@ class SP_Player_List extends SP_Custom_Post { $meta = get_post_meta( $stat->ID ); // Add equation to object - $stat->equation = sp_array_value( sp_array_value( $meta, 'sp_equation', array() ), 0, null ); + if ( $stat->post_type == 'sp_metric' ): + $stat->equation = null; + else: + $stat->equation = sp_array_value( sp_array_value( $meta, 'sp_equation', array() ), 0, 0 ); + endif; + + // Add precision to object $stat->precision = sp_array_value( sp_array_value( $meta, 'sp_precision', array() ), 0, 0 ); // Add column name to columns @@ -259,19 +266,19 @@ class SP_Player_List extends SP_Custom_Post { if ( ! $player_id ) continue; - $variables = array_merge( sp_array_value( $totals, $player_id, array() ), array_filter( sp_array_value( $placeholders, $player_id, array() ) ) ); + $placeholders[ $player_id ] = array_merge( sp_array_value( $totals, $player_id, array() ), array_filter( sp_array_value( $placeholders, $player_id, array() ) ) ); foreach ( $stats as $stat ): if ( sp_array_value( $placeholders[ $player_id ], $stat->post_name, '' ) == '' ): - if ( $stat->equation == null ): + if ( $stat->equation === null ): $placeholder = sp_array_value( sp_array_value( $adjustments, $player_id, array() ), $stat->post_name, null ); if ( $placeholder == null ): $placeholder = '-'; endif; else: // Solve - $placeholder = sp_solve( $stat->equation, $variables, $stat->precision ); + $placeholder = sp_solve( $stat->equation, $placeholders[ $player_id ], $stat->precision ); // Adjustments $placeholder += sp_array_value( sp_array_value( $adjustments, $player_id, array() ), $stat->post_name, 0 ); @@ -290,9 +297,9 @@ class SP_Player_List extends SP_Custom_Post { foreach( $placeholders as $player_id => $player_data ): - // Add player name to row + // Add player number and name to row $merged[ $player_id ] = array(); - + $player_data['number'] = get_post_meta( $player_id, 'sp_number', true ); $player_data['name'] = get_the_title( $player_id ); foreach( $player_data as $key => $value ):