mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
sort poll display
This commit is contained in:
parent
83978f1757
commit
40d0914b47
@ -104,7 +104,8 @@ class PollController extends EmailsController {
|
||||
|
||||
} else {
|
||||
// free access to poll
|
||||
return $this->json( sort( $poll->display()) );
|
||||
$pollResult = $poll->display();
|
||||
return $this->json( $pollResult );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -243,13 +243,13 @@ class Poll
|
||||
$content['admin_key'] = $this->getAdminKey();
|
||||
$content['password_hash'] = $this->getPassword();
|
||||
$content['id'] = $this->getId();
|
||||
|
||||
ksort($content);
|
||||
return $content;
|
||||
}
|
||||
|
||||
// counts each number of answer for this choice
|
||||
|
||||
public function display()
|
||||
public function display(): array
|
||||
{
|
||||
|
||||
$computedAnswers = $this->computeAnswers();
|
||||
@ -289,6 +289,7 @@ class Poll
|
||||
'votes_allowed' => $this->getVotesAllowed(),
|
||||
'votes_max' => $this->getVotesMax(),
|
||||
];
|
||||
ksort($resp);
|
||||
|
||||
return $resp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user