Simplify league table and player list value assignment

This commit is contained in:
Brian Miyaji
2016-04-11 19:46:41 +10:00
parent 8a9af049ca
commit aca031f774
2 changed files with 6 additions and 8 deletions

View File

@@ -543,10 +543,10 @@ class SP_League_Table extends SP_Custom_Post{
// Use static data if key exists and value is not empty, else use placeholder // Use static data if key exists and value is not empty, else use placeholder
if ( array_key_exists( $team_id, $tempdata ) && array_key_exists( $key, $tempdata[ $team_id ] ) && $tempdata[ $team_id ][ $key ] != '' ): if ( array_key_exists( $team_id, $tempdata ) && array_key_exists( $key, $tempdata[ $team_id ] ) && $tempdata[ $team_id ][ $key ] != '' ):
$merged[ $team_id ][ $key ] = $tempdata[ $team_id ][ $key ]; $value = $tempdata[ $team_id ][ $key ];
else:
$merged[ $team_id ][ $key ] = $value;
endif; endif;
$merged[ $team_id ][ $key ] = $value;
endforeach; endforeach;
@@ -645,7 +645,6 @@ class SP_League_Table extends SP_Custom_Post{
return $this->pos; return $this->pos;
} }
/** /**
* Calculate and add games back. * Calculate and add games back.
* *

View File

@@ -509,10 +509,10 @@ class SP_Player_List extends SP_Custom_Post {
// Use static data if key exists and value is not empty, else use placeholder // Use static data if key exists and value is not empty, else use placeholder
if ( array_key_exists( $player_id, $tempdata ) && array_key_exists( $key, $tempdata[ $player_id ] ) && $tempdata[ $player_id ][ $key ] != '' ): if ( array_key_exists( $player_id, $tempdata ) && array_key_exists( $key, $tempdata[ $player_id ] ) && $tempdata[ $player_id ][ $key ] != '' ):
$merged[ $player_id ][ $key ] = $tempdata[ $player_id ][ $key ]; $value = $tempdata[ $player_id ][ $key ];
else:
$merged[ $player_id ][ $key ] = $value;
endif; endif;
$merged[ $player_id ][ $key ] = $value;
endforeach; endforeach;
endforeach; endforeach;
@@ -605,5 +605,4 @@ class SP_Player_List extends SP_Custom_Post {
// Default sort by number // Default sort by number
return sp_array_value( $a, 'number', 0 ) - sp_array_value( $b, 'number', 0 ); return sp_array_value( $a, 'number', 0 ) - sp_array_value( $b, 'number', 0 );
} }
} }