Skip to content

Commit

Permalink
fix(openapi): Fix poll returned lists
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Nov 21, 2024
1 parent e5559f6 commit 83b7e2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Controller/PollController.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ protected function renderPoll(Poll $poll, array $votedSelf = [], array $detailed
$data['numVoters'] = 0;
}
} elseif ($poll->getResultMode() === Poll::MODE_PUBLIC && $poll->getStatus() === Poll::STATUS_CLOSED) {
$data['details'] = array_map(static fn (Vote $vote) => $vote->asArray(), $detailedVotes);
$data['details'] = array_values(array_map(static fn (Vote $vote) => $vote->asArray(), $detailedVotes));
}

$data['votedSelf'] = array_map(static fn (Vote $vote) => $vote->getOptionId(), $votedSelf);
$data['votedSelf'] = array_values(array_map(static fn (Vote $vote) => $vote->getOptionId(), $votedSelf));

return $data;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@
* }
*
* @psalm-type TalkPoll = TalkPollDraft&array{
* details?: TalkPollVote[],
* details?: list<TalkPollVote>,
* numVoters?: int<0, max>,
* votedSelf?: int[],
* votedSelf?: list<int>,
* votes?: array<string, int>,
* }
*
Expand Down

0 comments on commit 83b7e2e

Please sign in to comment.