Solve equations only when variables exist and events have been played
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user