enrich display config of a poll

This commit is contained in:
Tykayn 2021-04-26 15:21:19 +02:00 committed by tykayn
parent 7c1fbf7347
commit 1d72bfe684
2 changed files with 13 additions and 11 deletions

View File

@ -111,6 +111,11 @@ class PollController extends EmailsController {
foreach ( $stacks as $stack ) {
$displayedStackOfVotes[] = $stack->display();
}
$displayedChoices = [];
foreach ( $poll->getChoices() as $choice
) {
$displayedChoices[] = $choice->display();
}
$pass = $poll->getPassword();
$returnedPoll = [
@ -118,11 +123,9 @@ class PollController extends EmailsController {
'poll' => $poll->display(),
// TODO do not render sub objects of owner, it returns too many thing
'stacks_count' => count( $poll->getStacksOfVotes() ),
'stacks' => $displayedStackOfVotes,
'choices_count' => $poll->computeAnswers(),
'choices' => $displayedChoices,
'comments' => $displayedComments,
'comments_count' => count( $comments ),
];
/**

View File

@ -232,7 +232,6 @@ class Poll {
}
}
}
return [
'counts' => $computedArray,
'maxScore' => $maxScore,