Skip to content

Commit

Permalink
fix: same priority can not be assign to two diferrent options
Browse files Browse the repository at this point in the history
  • Loading branch information
MartaInes committed Dec 19, 2023
1 parent a6e3530 commit b256090
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion decide/booth/templates/booth/booth.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h2 class="voting-desc">[[ voting.question.desc ]]</h2>
<p> Remember that 1 is the highest priority and [[voting.question.options.length]] is the lowest priority</p>
<br>
<div v-for="(opt, index) in voting.question.options">
<select v-model="selected[index]">
<select class="select" v-model="selected[index]">
<option v-for="opt in voting.question.options">
[[ opt.number ]]
</option>
Expand Down Expand Up @@ -275,6 +275,11 @@ <h2 class="voting-desc">[[ voting.question.desc ]]</h2>
else if (this.questionType === 'P') {
var selectedOptions = this.voting.question.options.map((opt, index) => [opt.number, this.selected[index]]);
var vote = []
var priorities = selectedOptions.map((opt) => opt[1]);
var prioritiesSet = new Set(priorities);
if (priorities.length > prioritiesSet.size){
return
}
for (i=0; i < selectedOptions.length; i++){
var v = this.decideEncrypt(selectedOptions[i][0].toString())
vote.push({a: v.alpha.toString(), b: v.beta.toString(), p: selectedOptions[i][1].toString()})
Expand Down

0 comments on commit b256090

Please sign in to comment.