Merge pull request #12 from lewis-wow/pr/forms-fix

Pr/forms fix
This commit is contained in:
Ludvík Prokopec 2022-11-04 08:40:41 +01:00 committed by GitHub
commit 8ed3de3349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 14 deletions

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -2,14 +2,16 @@
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 //cca 12m nutno pozměnit!!!!!!!!!! tento komentář nemazat
console.log({ round, lat, lng })
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] const Mlat = [lat - round, lat + round]
let Mlng = [lng - width, lng + width] const 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