Prevent automatic results from calculating when no performance

This commit is contained in:
Brian Miyaji
2015-10-07 19:08:41 +11:00
parent 694ae1ebf9
commit ab3efd8024

View File

@@ -44,7 +44,6 @@ class SP_Meta_Box_Event_Results {
$finished = false; $finished = false;
// Check if any results are recorded // Check if any results are recorded
if ( ! $finished ) {
foreach ( $results as $team => $team_results ) { foreach ( $results as $team => $team_results ) {
foreach ( $team_results as $result ) { foreach ( $team_results as $result ) {
if ( '' !== $result ) { if ( '' !== $result ) {
@@ -53,22 +52,27 @@ class SP_Meta_Box_Event_Results {
} }
} }
} }
}
// Check if any performance is recorded // Check if any performance is recorded
if ( ! $finished ) { if ( ! $finished ) {
foreach ( $performance as $team => $players ) { foreach ( $performance as $team => $players ) {
foreach ( $players as $player => $pp ) { foreach ( $players as $player => $pp ) {
if ( 0 >= $player ) continue; if ( 0 >= $player ) continue;
foreach ( $pp as $pv ) { foreach ( $pp as $pk => $pv ) {
if ( '' !== trim( $pv ) ) { if ( in_array( $pk, apply_filters( 'sportspress_event_auto_result_bypass_keys', array( 'number', 'status', 'sub' ) ) ) ) continue;
if ( is_array( $pv ) ) continue;
$pv = trim( $pv );
if ( '' == $pv ) continue;
if ( ! ctype_digit( $pv ) ) continue;
$finished = true; $finished = true;
break; break;
} }
} }
} }
} }
}
if ( $finished ) { if ( $finished ) {
// Get results with equations // Get results with equations