experience fix bug

This commit is contained in:
Ota Prokopec 2023-03-19 19:13:51 +01:00
parent 385217c666
commit 86f95a52a4
6 changed files with 16 additions and 18 deletions

View File

@ -7,6 +7,7 @@
import Comparment from '../homepage/Components/Comparment.svelte'
let Search: string
//
</script>
<div class="content">

View File

@ -10,7 +10,6 @@
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
export let nextQuestion
export let attempt: 1 | 2 = 1
const answerCheckBox = async () => {
const arr = checkPoint.CPOptions.filter((item, i) => {
@ -18,9 +17,10 @@
})
const res = await answer(checkPoint.$id, arr)
if (res) control = 'correct'
else if (attempt === 1) control = 'wrong-firstTime'
else control = 'wrong-secondTime'
attempt++
else if (control === null) {
control = 'wrong-firstTime'
myAnswers = new Array(checkPoint.CPOptions.length).fill(false) //nulling answers
} else control = 'wrong-secondTime'
}
</script>

View File

@ -10,14 +10,14 @@
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
export let nextQuestion
export let attempt: 1 | 2 = 1
const answer_ = async () => {
const res = await answer(checkPoint.$id, myAnswer)
if (res) control = 'correct'
else if (attempt === 1) control = 'wrong-firstTime'
else control = 'wrong-secondTime'
attempt++
else if (control === null) {
control = 'wrong-firstTime'
myAnswer = '' //nulling answer
} else control = 'wrong-secondTime'
}
</script>

View File

@ -24,14 +24,13 @@
}
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
$: console.log(client)
let client = {
//user data about game
pos: 0,
pos: 1,
end: gameData.checkPoints.length - 1, //kolik otázek
points: 0, //body
possiblePointsToSeize: gameData.checkPoints.length * 2,

View File

@ -10,14 +10,14 @@
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
export let nextQuestion
export let attempt: 1 | 2 = 1
const answer_ = async () => {
const res = await answer(checkPoint.$id, myAnswer)
if (res) control = 'correct'
else if (attempt === 1) control = 'wrong-firstTime'
else control = 'wrong-secondTime'
attempt++
else if (control === null) {
control = 'wrong-firstTime'
myAnswer = ''
} else control = 'wrong-secondTime'
}
</script>

View File

@ -10,14 +10,12 @@
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
export let nextQuestion
export let attempt: 1 | 2 = 1
const answer_ = async () => {
const res = await answer(checkPoint.$id, myAnswer)
if (res) control = 'correct'
else if (attempt === 1) control = 'wrong-firstTime'
else if (control === null) control = 'wrong-firstTime'
else control = 'wrong-secondTime'
attempt++
}
</script>