mirror of https://github.com/bra1n/townsquare.git
fix voting issues
This commit is contained in:
parent
acb2178fe9
commit
7bf5f69fbc
|
@ -50,7 +50,7 @@
|
||||||
Countdown
|
Countdown
|
||||||
</div>
|
</div>
|
||||||
<div class="button" v-if="!session.isVoteInProgress" @click="start">
|
<div class="button" v-if="!session.isVoteInProgress" @click="start">
|
||||||
Start
|
{{ session.lockedVote ? "Restart" : "Start" }}
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div
|
<div
|
||||||
|
@ -175,13 +175,14 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
countdown() {
|
countdown() {
|
||||||
this.$store.commit("session/setVoteInProgress", true);
|
this.$store.commit("session/setVoteInProgress", true);
|
||||||
|
this.$store.commit("session/lockVote", 0);
|
||||||
this.voteTimer = setInterval(() => {
|
this.voteTimer = setInterval(() => {
|
||||||
this.start();
|
this.start();
|
||||||
}, 4000);
|
}, 4000);
|
||||||
},
|
},
|
||||||
start() {
|
start() {
|
||||||
this.$store.commit("session/setVoteInProgress", true);
|
this.$store.commit("session/setVoteInProgress", true);
|
||||||
this.$store.commit("session/lockVote");
|
this.$store.commit("session/lockVote", 1);
|
||||||
clearInterval(this.voteTimer);
|
clearInterval(this.voteTimer);
|
||||||
this.voteTimer = setInterval(() => {
|
this.voteTimer = setInterval(() => {
|
||||||
this.$store.commit("session/lockVote");
|
this.$store.commit("session/lockVote");
|
||||||
|
@ -196,7 +197,13 @@ export default {
|
||||||
clearInterval(this.voteTimer);
|
clearInterval(this.voteTimer);
|
||||||
this.voteTimer = null;
|
this.voteTimer = null;
|
||||||
} else {
|
} else {
|
||||||
this.start();
|
this.voteTimer = setInterval(() => {
|
||||||
|
this.$store.commit("session/lockVote");
|
||||||
|
if (this.session.lockedVote > this.players.length) {
|
||||||
|
clearInterval(this.voteTimer);
|
||||||
|
this.$store.commit("session/setVoteInProgress", false);
|
||||||
|
}
|
||||||
|
}, this.session.votingSpeed);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
|
|
Loading…
Reference in New Issue