we can skip some of the calls for tourneys we're already skipping

This commit is contained in:
Ben Harris 2023-11-06 17:16:35 -05:00
parent cdfe43a125
commit 392dc33817
1 changed files with 11 additions and 7 deletions

View File

@ -31,6 +31,12 @@ while ( true ) {
$tournaments = json_decode( $body );
foreach ( $tournaments->data as $tournament ) {
// skip finals
if ( $tournament->linkedTournamentId === null ) {
continue;
}
echo PHP_EOL . $tournament->name . PHP_EOL;
$tournamentDetails = $client->get( "tournaments/{$tournament->tournamentId}", [
'query' => [
'includePlayers' => '1',
@ -39,14 +45,12 @@ while ( true ) {
] )->getBody();
$details = json_decode( $tournamentDetails );
// skip finals
if ( $details->data->linkedTournamentId === null ) {
continue;
}
echo $details->data->name;
$playerCount = count( $details->data->players );
echo $playerCount;
echo $playerCount . PHP_EOL;
if (!isset($playerCounts[$details->data->location->name]))
$playerCounts[$details->data->location->name] = 0;
$playerCounts[ $details->data->location->name ] += $playerCount;
}