#51 : make empty vote different from 'No'

This commit is contained in:
ecmu 2016-03-13 16:20:38 +01:00
parent 84414aeb97
commit 8216bcbaa6
3 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,7 @@ class VoteRepository extends AbstractRepository {
}
function insertDefault($poll_id, $insert_position) {
$prepared = $this->prepare('UPDATE `' . Utils::table('vote') . '` SET choices = CONCAT(SUBSTRING(choices, 1, ?), "0", SUBSTRING(choices, ?)) WHERE poll_id = ?');
$prepared = $this->prepare('UPDATE `' . Utils::table('vote') . '` SET choices = CONCAT(SUBSTRING(choices, 1, ?), " ", SUBSTRING(choices, ?)) WHERE poll_id = ?'); //#51 : default value for unselected vote
return $prepared->execute([$insert_position, $insert_position + 1, $poll_id]);
}

View File

@ -74,6 +74,9 @@
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
</label>
</li>
<li style='display:none'> {* #51 : default value for unselected vote *}
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value=" " {if $choice!='2' && $choice!='1' && $choice!='0'}checked {/if}/>
</li>
</ul>
</td>
{/foreach}
@ -297,4 +300,4 @@
</div>
</div>
{/if}
{/if}
{/if}

View File

@ -122,6 +122,9 @@
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
</label>
</li>
<li style='display:none'> {* #51 : default value for unselected vote *}
<input type="radio" id="n-choice-{$k}" name="choices[{$k}]" value=" " {if $choice!='2' && $choice!='1' && $choice!='0'}checked {/if}/>
</li>
</ul>
</td>
{/foreach}
@ -352,4 +355,4 @@
</div>
</div>
{/if}
{/if}
{/if}