Solve equations only when variables exist and events have been played

This commit is contained in:
Brian Miyaji
2014-01-01 23:38:19 +11:00
parent 900bebee72
commit 6aef61164d
4 changed files with 51 additions and 8 deletions

View File

@@ -146,7 +146,11 @@ function sp_player_stats_meta( $post ) {
else:
// Calculate value
$placeholders[ $team_id ][ $div_id ][ $key ] = $eos->solveIF( str_replace( ' ', '', $value ), $totals );
if ( sizeof( $events ) > 0 ):
$placeholders[ $team_id ][ $div_id ][ $key ] = sp_solve( $value, $totals );
else:
$placeholders[ $team_id ][ $div_id ][ $key ] = 0;
endif;
endif;

View File

@@ -134,7 +134,11 @@ function sp_team_columns_meta( $post ) {
// Generate array of placeholder values for each league
$placeholders[ $div_id ] = array();
foreach ( $equations as $key => $value ):
$placeholders[ $div_id ][ $key ] = $eos->solveIF( str_replace( ' ', '', $value ), $totals );
if ( sizeof( $events ) > 0 ):
$placeholders[ $div_id ][ $key ] = sp_solve( $value, $totals );
else:
$placeholders[ $div_id ][ $key ] = 0;
endif;
endforeach;
endforeach;