Merge pull request #280 from kadimi/patch-16

Apply "Reverse Teams" to home and away records
This commit is contained in:
Brian Miyaji
2018-07-09 16:00:36 +10:00
committed by GitHub

View File

@@ -550,6 +550,12 @@ class SP_League_Table extends SP_Secondary_Post {
$totals[ $team_id ]['last10'] = $last10;
endforeach;
// Reverse home and away records when "Reverse Teams" is enabled.
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
if ( $reverse_teams ) {
list( $homerecords, $awayrecords ) = array( $awayrecords, $homerecords );
}
foreach ( $homerecords as $team_id => $homerecord ):
// Add home record to totals
$totals[ $team_id ]['homerecord'] = $homerecord;