fix votes wrongly calculated because of type check

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-02-20 15:17:14 +01:00
parent 2d39a83a7f
commit 76b19ee9ba
3 changed files with 11 additions and 11 deletions

View File

@ -113,7 +113,7 @@ class PollService {
function addComment($poll_id, $name, $comment) {
if ($this->commentRepository->exists($poll_id, $name, $comment)) {
return true;
}
}
return $this->commentRepository->insert($poll_id, $name, $comment);
}
@ -160,10 +160,10 @@ class PollService {
$result['inb'][$i] = 0;
$result['y'][$i] = 0;
}
if ($choice === 1) {
if ($choice === "1") {
$result['inb'][$i]++;
}
if ($choice === 2) {
if ($choice === "2") {
$result['y'][$i]++;
}
}

View File

@ -190,7 +190,7 @@
</ul>
</td>
{$i = $i+1}
{/foreach}
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results', 'Save the choices')}">{__('Generic', 'Save')}</button></td>
</tr>

View File

@ -219,17 +219,17 @@
<input type="text" id="name" name="name" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
</div>
</td>
{$i = 0}
{foreach $slots as $slot}
{foreach $slots as $slot}
{foreach $slot->moments as $moment}
<td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$headersH[$i]}">
<ul class="list-unstyled choice">
{if $best_choices['y'][$i] lt $poll->ValueMax || $poll->ValueMax eq NULL}
{if $best_choices['y'][$i] lt $poll->ValueMax || $poll->ValueMax eq NULL}
<li class="yes">
<input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2" />
<label class="btn btn-default btn-xs" for="y-choice-{$i}" title="{__('Poll results', 'Vote yes for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
@ -242,7 +242,7 @@
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
</label>
</li>
{/if}
<li class="no">
@ -257,7 +257,7 @@
</ul>
</td>
{$i = $i+1}
{/foreach}