fix pr/forms bugs
This commit is contained in:
parent
a2a99cedda
commit
1642e2d211
|
@ -4,7 +4,7 @@
|
||||||
import parseQuestion from '$lib/utils/parseQuestion'
|
import parseQuestion from '$lib/utils/parseQuestion'
|
||||||
|
|
||||||
export let gameData
|
export let gameData
|
||||||
let answers = parseQuestion(gameData.question.answer, gameData.question.type)
|
let answer = parseQuestion(gameData.question.answer, gameData.question.type)
|
||||||
let myAnswer = ''
|
let myAnswer = ''
|
||||||
|
|
||||||
export let nextQuestion
|
export let nextQuestion
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
myAnswer = ''
|
myAnswer = ''
|
||||||
}}
|
}}
|
||||||
{control}
|
{control}
|
||||||
on:submit={() => (control = myAnswer !== '' ? myAnswer === answers.answer : null)}
|
on:submit={() => (control = myAnswer !== '' ? myAnswer == answer : null)}
|
||||||
>
|
>
|
||||||
<span slot="title">{gameData.name}</span>
|
<span slot="title">{gameData.name}</span>
|
||||||
<span slot="about">{@html gameData.question.question}</span>
|
<span slot="about">{@html gameData.question.question}</span>
|
||||||
|
|
|
@ -38,14 +38,13 @@
|
||||||
export let gameData = {} //data
|
export let gameData = {} //data
|
||||||
|
|
||||||
$: answers = parseQuestion(gameData.questions[clientAnswers.pos].answer, gameData.questions[clientAnswers.pos].type) //delete
|
$: answers = parseQuestion(gameData.questions[clientAnswers.pos].answer, gameData.questions[clientAnswers.pos].type) //delete
|
||||||
|
let page
|
||||||
|
$: page = components[gameData.questions[clientAnswers.pos].type]
|
||||||
let clientAnswers = {
|
let clientAnswers = {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
end: gameData.questions.length, //kolik otázek
|
end: gameData.questions.length, //kolik otázek
|
||||||
points: 0, //body
|
points: 0, //body
|
||||||
}
|
}
|
||||||
let page
|
|
||||||
$: page = components[gameData.questions[clientAnswers.pos].type]
|
|
||||||
|
|
||||||
/*jen pro tedkon, pozdeji vymazat az bude singlechoise a multichoise oddelene*/
|
/*jen pro tedkon, pozdeji vymazat az bude singlechoise a multichoise oddelene*/
|
||||||
$: page = gameData.questions[clientAnswers.pos].type === 'CHOICE' ? components[vals()] : page
|
$: page = gameData.questions[clientAnswers.pos].type === 'CHOICE' ? components[vals()] : page
|
||||||
|
|
|
@ -10,10 +10,11 @@
|
||||||
export let control = null
|
export let control = null
|
||||||
export let nextQuestion
|
export let nextQuestion
|
||||||
|
|
||||||
const rightAnswer = () =>
|
const rightAnswer = () => {
|
||||||
answers.map((item) => {
|
return answers.filter((item) => {
|
||||||
if (item.value) return item.label
|
if (item.value) return item.label
|
||||||
})
|
})[0].label
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout
|
<Layout
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import parseQuestion from '$lib/utils/parseQuestion'
|
import parseQuestion from '$lib/utils/parseQuestion'
|
||||||
|
|
||||||
export let gameData
|
export let gameData
|
||||||
let answers = parseQuestion(gameData.question.answer, gameData.question.type)
|
let answer = parseQuestion(gameData.question.answer, gameData.question.type)
|
||||||
let myAnswer = ''
|
let myAnswer = ''
|
||||||
|
|
||||||
export let control = null
|
export let control = null
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
nextQuestion()
|
nextQuestion()
|
||||||
myAnswer = ''
|
myAnswer = ''
|
||||||
}}
|
}}
|
||||||
on:submit={() => (control = myAnswer !== '' ? compare(myAnswer, answers.answer) : null)}
|
on:submit={() => (control = myAnswer !== '' ? compare(myAnswer, answer) : null)}
|
||||||
>
|
>
|
||||||
<span slot="title">{gameData.name}</span>
|
<span slot="title">{gameData.name}</span>
|
||||||
<span slot="about">{@html gameData.question.question}</span>
|
<span slot="about">{@html gameData.question.question}</span>
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
import { Marker } from '@beyonk/svelte-mapbox'
|
import { Marker } from '@beyonk/svelte-mapbox'
|
||||||
import { createEventDispatcher, getContext } from 'svelte'
|
import { createEventDispatcher, getContext } from 'svelte'
|
||||||
|
|
||||||
export let lat, lng
|
export let lat = null
|
||||||
export let width = 0.004
|
export let lng = null
|
||||||
|
export let round = (1 / 110.574 / 1000) * 12 * 5222525 //cca 12m nutno pozměnit!!!!!!!!!! tento komentář nemazat
|
||||||
export let user = { lat: 0, lng: 0 }
|
export let user = { lat: 0, lng: 0 }
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let Mlat = [lat - width, lat + width]
|
let Mlat = [lat - round, lat + round]
|
||||||
let Mlng = [lng - width, lng + width]
|
let Mlng = [lng - round, lng + round]
|
||||||
|
|
||||||
$: isIn = user ? user.lat > Mlat[0] && user.lat < Mlat[1] && user.lng > Mlng[0] && user.lng < Mlng[1] : null
|
$: isIn = user ? user.lat > Mlat[0] && user.lat < Mlat[1] && user.lng > Mlng[0] && user.lng < Mlng[1] : null
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue