sort poll display

master
Tykayn 10 months ago committed by tykayn
parent 83978f1757
commit 40d0914b47
  1. 3
      src/Controller/api/v1/PollController.php
  2. 5
      src/Entity/Poll.php

@ -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…
Cancel
Save