fix (pre-)vote calculation being off by one if the nominee votes (fixes #131)

This commit is contained in:
Steffen 2021-03-14 20:41:56 +01:00
parent a849001068
commit f0c09cf497
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
1 changed files with 12 additions and 12 deletions

View File

@ -10,17 +10,14 @@
<em>{{ nominee.name }}</em <em>{{ nominee.name }}</em
>! >!
<br /> <br />
<template v-if="nominee.role.team !== 'traveler'"> <em class="blue">
<em class="blue"> {{ voters.length }} vote{{ voters.length !== 1 ? "s" : "" }}
{{ voters.length }} vote{{ voters.length !== 1 ? "s" : "" }} </em>
</em> in favor
in favor <em v-if="nominee.role.team !== 'traveler'">
<em>(majority is {{ Math.ceil(alive / 2) }})</em> (majority is {{ Math.ceil(alive / 2) }})
</template> </em>
<template v-else> <em v-else>(majority is {{ Math.ceil(players.length / 2) }})</em>
<em>{{ Math.ceil(players.length / 2) }} votes</em> required for a
<em>majority</em>.
</template>
<div v-if="session.isVoteInProgress || session.lockedVote > 1"> <div v-if="session.isVoteInProgress || session.lockedVote > 1">
<em class="blue" v-if="voters.length">{{ voters.join(", ") }} </em> <em class="blue" v-if="voters.length">{{ voters.join(", ") }} </em>
@ -170,7 +167,10 @@ export default {
...voters.slice(nomination + 1), ...voters.slice(nomination + 1),
...voters.slice(0, nomination + 1) ...voters.slice(0, nomination + 1)
]; ];
return reorder.slice(0, this.session.lockedVote - 1).filter(n => !!n); return (this.session.lockedVote
? reorder.slice(0, this.session.lockedVote - 1)
: reorder
).filter(n => !!n);
} }
}, },
data() { data() {