fix votes wrongly calculated because of type check
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
2d39a83a7f
commit
76b19ee9ba
|
@ -113,7 +113,7 @@ class PollService {
|
||||||
function addComment($poll_id, $name, $comment) {
|
function addComment($poll_id, $name, $comment) {
|
||||||
if ($this->commentRepository->exists($poll_id, $name, $comment)) {
|
if ($this->commentRepository->exists($poll_id, $name, $comment)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return $this->commentRepository->insert($poll_id, $name, $comment);
|
return $this->commentRepository->insert($poll_id, $name, $comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,10 +160,10 @@ class PollService {
|
||||||
$result['inb'][$i] = 0;
|
$result['inb'][$i] = 0;
|
||||||
$result['y'][$i] = 0;
|
$result['y'][$i] = 0;
|
||||||
}
|
}
|
||||||
if ($choice === 1) {
|
if ($choice === "1") {
|
||||||
$result['inb'][$i]++;
|
$result['inb'][$i]++;
|
||||||
}
|
}
|
||||||
if ($choice === 2) {
|
if ($choice === "2") {
|
||||||
$result['y'][$i]++;
|
$result['y'][$i]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
{$i = $i+1}
|
{$i = $i+1}
|
||||||
|
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results', 'Save the choices')}">{__('Generic', 'Save')}</button></td>
|
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results', 'Save the choices')}">{__('Generic', 'Save')}</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -219,17 +219,17 @@
|
||||||
<input type="text" id="name" name="name" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
<input type="text" id="name" name="name" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
{$i = 0}
|
{$i = 0}
|
||||||
{foreach $slots as $slot}
|
{foreach $slots as $slot}
|
||||||
{foreach $slot->moments as $moment}
|
{foreach $slot->moments as $moment}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$headersH[$i]}">
|
<td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$headersH[$i]}">
|
||||||
<ul class="list-unstyled choice">
|
<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">
|
<li class="yes">
|
||||||
<input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2" />
|
<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}">
|
<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>
|
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<li class="no">
|
<li class="no">
|
||||||
|
@ -257,7 +257,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$i = $i+1}
|
{$i = $i+1}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user