1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

compute answers in choices

This commit is contained in:
Tykayn 2021-04-27 11:17:41 +02:00 committed by tykayn
parent 665cf6d173
commit 8c2ad610a5

View File

@ -263,7 +263,7 @@ class Poll {
,
'password_protected' => $this->getPassword() ? 'yes' : 'no',
'max_score' => $computedAnswers[ 'max_score' ],
'choices' => $displayedChoices,
'choices' => $computedAnswers[ 'answers' ],
'stacks' => $displayedStackOfVotes,
'comments' => $displayedComments,
];
@ -321,9 +321,13 @@ class Poll {
}
}
}
$answersWithStats = [];
foreach ( $computedArray as $choice_stat ) {
$answersWithStats[] = $choice_stat;
}
return [
'answers' => $computedArray,
'answers' => $answersWithStats,
'max_score' => $maxScore,
];
}