Skip to content

Commit

Permalink
fix #36 idx counter
Browse files Browse the repository at this point in the history
  • Loading branch information
solidusite committed Sep 20, 2017
1 parent 9e93baf commit eb18842
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/components/polls/elements/snippets/snippet.polls.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@
$answers = $modx->getCollection('modPollAnswer',$ans);

$answersOutput = '';
foreach($answers as $idx => $answer) {
$idx = 1;
foreach($answers as $k => $answer) {
$answerParams = array_merge(
$answer->toArray(), array(
'percent' => $answer->getVotesPercent($placeholders['totalVotes']),
'idx' => $idx
));
$idx++;
$answersOutput .= $modx->getChunk((!$poll->hasVoted() ? $tplVoteAnswer : $tplResultAnswer), $answerParams);
}

Expand Down

0 comments on commit eb18842

Please sign in to comment.