Commit 93674110 authored by Christoph Pascher's avatar Christoph Pascher
Browse files

updating score for result page

parent 9eb1df4f
......@@ -167,6 +167,7 @@ class FeElectionController extends ActionController
public function showAction(Election $election)
{
$this->view->assign('election', $election);
$this->view->assign('results',$election->getElectedNomineesAndVotes());
}
......
......@@ -260,7 +260,7 @@ class Election extends AbstractEntity
{
$nominees = [];
/** @var ElectionVote $electionVote */
foreach ($this->electionVotes as $electionVote) {
foreach ($this->getElectionVotes() as $electionVote) {
$nominee = $electionVote->getNominee();
$uid = $nominee->getUid();
if (isset($nominees[$uid])) {
......@@ -269,6 +269,10 @@ class Election extends AbstractEntity
$nominees[$uid]['votes'] = 1;
$nominees[$uid]['nominee'] = $nominee;
}
if($this->getElectionVotes()>0){
$nominees[$uid]['relativevotes'] =
round($nominees[$uid]['votes'] / count($this->getElectionVotes()) * 100,2);
}
}
uasort(
$nominees,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment