mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
enrich display config of a poll
This commit is contained in:
parent
7c1fbf7347
commit
1d72bfe684
@ -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 ),
|
||||
];
|
||||
|
||||
/**
|
||||
@ -138,7 +141,7 @@ class PollController extends EmailsController {
|
||||
} else {
|
||||
// free access to poll
|
||||
// return $this->returnPollData( $poll, $serializer );
|
||||
return $this->json($returnedPoll);
|
||||
return $this->json( $returnedPoll );
|
||||
// return $this->json($poll);
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,6 @@ class Poll {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'counts' => $computedArray,
|
||||
'maxScore' => $maxScore,
|
||||
|
Loading…
Reference in New Issue
Block a user