Skip to content

Commit

Permalink
Types for medallists
Browse files Browse the repository at this point in the history
  • Loading branch information
bakert committed Nov 21, 2024
1 parent c527b89 commit c851224
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gatherling/Models/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -1638,10 +1638,10 @@ public function assignMedalsByStandings(): void

$t8 = $t4 = [];
if ($medalCount >= 8) {
$t8 = array_map(fn($i) => $players[$i]->player, [4, 5, 6, 7]);
$t8 = array_values(array_filter(array_map(fn($i) => $players[$i]->player ?? null, [4, 5, 6, 7])));
}
if ($medalCount >= 4) {
$t4 = array_map(fn($i) => $players[$i]->player, [2, 3]);
$t4 = array_values(array_filter(array_map(fn($i) => $players[$i]->player ?? null, [2, 3])));
}
$sec = $players[1]->player ?? null;
$win = $players[0]->player;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions gatherling/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,8 @@ function updateMedals(): void

$winner = post()->string('newmatchplayer1');
$second = post()->optionalString('newmatchplayer2');
$t4 = [post()->optionalString('newmatchplayer3'), post()->optionalString('newmatchplayer4')];
$t8 = [post()->optionalString('newmatchplayer5'), post()->optionalString('newmatchplayer6'), post()->optionalString('newmatchplayer7'), post()->optionalString('newmatchplayer8')];
$t4 = array_values(array_filter([post()->optionalString('newmatchplayer3'), post()->optionalString('newmatchplayer4')]));
$t8 = array_values(array_filter([post()->optionalString('newmatchplayer5'), post()->optionalString('newmatchplayer6'), post()->optionalString('newmatchplayer7'), post()->optionalString('newmatchplayer8')]));

$event->setFinalists($winner, $second, $t4, $t8);
}
Expand Down

0 comments on commit c851224

Please sign in to comment.