diff --git a/src/assets/base.css b/src/assets/base.css index a939e60..6d8db1c 100644 --- a/src/assets/base.css +++ b/src/assets/base.css @@ -36,7 +36,6 @@ *::after { box-sizing: border-box; margin: 0; - position: relative; font-weight: normal; } diff --git a/src/components/Score.vue b/src/components/Score.vue index 3f215e1..c9ca3da 100644 --- a/src/components/Score.vue +++ b/src/components/Score.vue @@ -33,6 +33,7 @@ function formatAnswers(answers) { id: answer.id, title: translation.length > 0 ? translation[0].title : "", weight: answer.weight, + image: answer.image, }; }) .filter((answer) => answer.title); @@ -47,9 +48,10 @@ function formatScore(score) { ); return { id: question.id, - value: null, + weight: null, title: translation.length > 0 ? translation[0].title : "", answers: formatAnswers(question.answers), + splide: ref(), }; }) .filter((question) => question.title); @@ -57,16 +59,17 @@ function formatScore(score) { const title = score ? score.title : ""; const questions = ref(formatScore(score)); +console.log(questions.value) function nextQuestion() { setTimeout(() => slides.value.go(">"), 100); } const scoreSum = computed(() => { return questions.value - .map((question) => question.value) + .map((question) => question.weight) .reduce((value, currentValue) => value + currentValue, 0); }); const displayScoreResult = computed( - () => !questions.value.filter((q) => q.value == null).length + () => !questions.value.filter((q) => q.weight == null).length ); function getResultsFromScore(score) { return score.results @@ -94,12 +97,21 @@ const result = computed(() => .filter((r) => !r.max || r.max >= scoreSum.value)[0] : null ); +function selectImage(event, question, answer) { + const input = document.querySelector(`input[name='question_${question.id}'][value='${answer.weight}']`) + if (input) { + input.checked = true + input.dispatchEvent(new Event("change")) + } + nextQuestion() +}