Fix: Character cases causing interface not recognize the game end. (closes #47)
This commit is contained in:
parent
78d1d979de
commit
daa18d6a9a
2 changed files with 17 additions and 4 deletions
|
|
@ -13,7 +13,8 @@
|
||||||
v-for="answerIndex in 8"
|
v-for="answerIndex in 8"
|
||||||
:class="[
|
:class="[
|
||||||
`answer`,
|
`answer`,
|
||||||
answers[`team_${3 - $store.state.team}`][answerIndex-1].toLowerCase() == $store.state.chosen_object+`.` ? `correct`: ``
|
answers[`team_${3 - $store.state.team}`][answerIndex-1].toLowerCase() === getObject
|
||||||
|
? `correct`: ``
|
||||||
]"
|
]"
|
||||||
:key="`${otherTeamID}-answer-container-${answerIndex}`"
|
:key="`${otherTeamID}-answer-container-${answerIndex}`"
|
||||||
>
|
>
|
||||||
|
|
@ -57,7 +58,8 @@
|
||||||
v-for="answerIndex in 8"
|
v-for="answerIndex in 8"
|
||||||
:class="[
|
:class="[
|
||||||
`answer`,
|
`answer`,
|
||||||
answers[`team_${$store.state.team}`][answerIndex-1].toLowerCase() == $store.state.chosen_object+`.` ? `correct`: ``
|
answers[`team_${$store.state.team}`][answerIndex-1].toLowerCase() === getObject
|
||||||
|
? `correct`: ``
|
||||||
]"
|
]"
|
||||||
:key="`${teamID}-answer-container-${answerIndex}`"
|
:key="`${teamID}-answer-container-${answerIndex}`"
|
||||||
>
|
>
|
||||||
|
|
@ -122,6 +124,12 @@ export default {
|
||||||
answers() {
|
answers() {
|
||||||
return this.$store.state.answers;
|
return this.$store.state.answers;
|
||||||
},
|
},
|
||||||
|
getObject() {
|
||||||
|
if (!this.$store.state.chosen_object) {
|
||||||
|
return ``;
|
||||||
|
};
|
||||||
|
return this.$store.state.chosen_object.toLowerCase() + `.`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isCorrect(team, answerIndex) {
|
isCorrect(team, answerIndex) {
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,13 @@ export default {
|
||||||
gameOver() {
|
gameOver() {
|
||||||
if (this.$store.state.chosen_object) {
|
if (this.$store.state.chosen_object) {
|
||||||
let targetAnswer = this.$store.state.chosen_object.toLowerCase()+`.`;
|
let targetAnswer = this.$store.state.chosen_object.toLowerCase()+`.`;
|
||||||
return this.$store.state.answers.team_1.includes(targetAnswer)
|
for (var team in this.$store.state.answers) {
|
||||||
|| this.$store.state.answers.team_2.includes(targetAnswer);
|
for (var answer of this.$store.state.answers[team]) {
|
||||||
|
if (answer.toLowerCase() === targetAnswer) {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue