experience fix bug
This commit is contained in:
parent
385217c666
commit
86f95a52a4
|
@ -7,6 +7,7 @@
|
||||||
import Comparment from '../homepage/Components/Comparment.svelte'
|
import Comparment from '../homepage/Components/Comparment.svelte'
|
||||||
|
|
||||||
let Search: string
|
let Search: string
|
||||||
|
//
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
||||||
export let nextQuestion
|
export let nextQuestion
|
||||||
export let attempt: 1 | 2 = 1
|
|
||||||
|
|
||||||
const answerCheckBox = async () => {
|
const answerCheckBox = async () => {
|
||||||
const arr = checkPoint.CPOptions.filter((item, i) => {
|
const arr = checkPoint.CPOptions.filter((item, i) => {
|
||||||
|
@ -18,9 +17,10 @@
|
||||||
})
|
})
|
||||||
const res = await answer(checkPoint.$id, arr)
|
const res = await answer(checkPoint.$id, arr)
|
||||||
if (res) control = 'correct'
|
if (res) control = 'correct'
|
||||||
else if (attempt === 1) control = 'wrong-firstTime'
|
else if (control === null) {
|
||||||
else control = 'wrong-secondTime'
|
control = 'wrong-firstTime'
|
||||||
attempt++
|
myAnswers = new Array(checkPoint.CPOptions.length).fill(false) //nulling answers
|
||||||
|
} else control = 'wrong-secondTime'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
||||||
export let nextQuestion
|
export let nextQuestion
|
||||||
export let attempt: 1 | 2 = 1
|
|
||||||
|
|
||||||
const answer_ = async () => {
|
const answer_ = async () => {
|
||||||
const res = await answer(checkPoint.$id, myAnswer)
|
const res = await answer(checkPoint.$id, myAnswer)
|
||||||
if (res) control = 'correct'
|
if (res) control = 'correct'
|
||||||
else if (attempt === 1) control = 'wrong-firstTime'
|
else if (control === null) {
|
||||||
else control = 'wrong-secondTime'
|
control = 'wrong-firstTime'
|
||||||
attempt++
|
myAnswer = '' //nulling answer
|
||||||
|
} else control = 'wrong-secondTime'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null = null
|
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null = null
|
||||||
let view: 'question' | 'map' | 'end' = 'map'
|
let view: 'question' | 'map' | 'end' = 'question'
|
||||||
|
|
||||||
export let gameData: Experience //data
|
export let gameData: Experience //data
|
||||||
$: console.log(client)
|
|
||||||
|
|
||||||
let client = {
|
let client = {
|
||||||
//user data about game
|
//user data about game
|
||||||
pos: 0,
|
pos: 1,
|
||||||
end: gameData.checkPoints.length - 1, //kolik otázek
|
end: gameData.checkPoints.length - 1, //kolik otázek
|
||||||
points: 0, //body
|
points: 0, //body
|
||||||
possiblePointsToSeize: gameData.checkPoints.length * 2,
|
possiblePointsToSeize: gameData.checkPoints.length * 2,
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
||||||
export let nextQuestion
|
export let nextQuestion
|
||||||
export let attempt: 1 | 2 = 1
|
|
||||||
|
|
||||||
const answer_ = async () => {
|
const answer_ = async () => {
|
||||||
const res = await answer(checkPoint.$id, myAnswer)
|
const res = await answer(checkPoint.$id, myAnswer)
|
||||||
if (res) control = 'correct'
|
if (res) control = 'correct'
|
||||||
else if (attempt === 1) control = 'wrong-firstTime'
|
else if (control === null) {
|
||||||
else control = 'wrong-secondTime'
|
control = 'wrong-firstTime'
|
||||||
attempt++
|
myAnswer = ''
|
||||||
|
} else control = 'wrong-secondTime'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,12 @@
|
||||||
|
|
||||||
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
|
||||||
export let nextQuestion
|
export let nextQuestion
|
||||||
export let attempt: 1 | 2 = 1
|
|
||||||
|
|
||||||
const answer_ = async () => {
|
const answer_ = async () => {
|
||||||
const res = await answer(checkPoint.$id, myAnswer)
|
const res = await answer(checkPoint.$id, myAnswer)
|
||||||
if (res) control = 'correct'
|
if (res) control = 'correct'
|
||||||
else if (attempt === 1) control = 'wrong-firstTime'
|
else if (control === null) control = 'wrong-firstTime'
|
||||||
else control = 'wrong-secondTime'
|
else control = 'wrong-secondTime'
|
||||||
attempt++
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue