diff --git a/scripts/fetchData.js b/scripts/fetchData.js index 977e631..0d57893 100644 --- a/scripts/fetchData.js +++ b/scripts/fetchData.js @@ -1,7 +1,7 @@ -import {createWriteStream, existsSync, mkdirSync} from 'fs'; +import { createWriteStream, existsSync, mkdirSync } from "fs"; import fs from "fs/promises"; -import {pipeline} from 'stream'; -import {promisify} from 'util' +import { pipeline } from "stream"; +import { promisify } from "util"; const streamPipeline = promisify(pipeline); const apiUrl = "https://admin.ceiba-conseil.com"; @@ -26,7 +26,7 @@ async function fetchJSONApi(path) { async function fetchAsset(uuid) { const url = `${apiUrl}/assets/${uuid}`; - return fetch(url) + return fetch(url); } async function fetchData() { @@ -49,15 +49,18 @@ async function fetchData() { const data = (await fetchJSONApi(url)).data; await fs.writeFile("./src/data.json", JSON.stringify(data), "utf8"); - const folder = 'public/answers' + const folder = "public/answers"; if (!existsSync(folder)) mkdirSync(folder); for (const score of data) { for (const question of score.questions) { for (const answer of question.questions_id.answers) { - const uuid = answer.answers_id.image + const uuid = answer.answers_id.image; if (uuid) { - const response = await fetchAsset(uuid) - await streamPipeline(response.body, createWriteStream(`${folder}/${uuid}.png`)); + const response = await fetchAsset(uuid); + await streamPipeline( + response.body, + createWriteStream(`${folder}/${uuid}.png`) + ); } } } diff --git a/src/components/Score.vue b/src/components/Score.vue index 15547ad..a1b06e1 100644 --- a/src/components/Score.vue +++ b/src/components/Score.vue @@ -59,7 +59,7 @@ function formatScore(score) { const title = score ? score.title : ""; const questions = ref(formatScore(score)); -console.log(questions.value) +console.log(questions.value); function nextQuestion() { setTimeout(() => slides.value.go(">"), 100); } @@ -98,15 +98,19 @@ const result = computed(() => : null ); function selectImage(event, question, answer) { - const input = document.querySelector(`input[name='question_${question.id}'][value='${answer.weight}']`) + const input = document.querySelector( + `input[name='question_${question.id}'][value='${answer.weight}']` + ); if (input) { - input.checked = true - input.dispatchEvent(new Event("change")) + input.checked = true; + input.dispatchEvent(new Event("change")); } - nextQuestion() + nextQuestion(); } function geQuestionSlide(question) { - slides.value.go(questions.value.findIndex((element, index) => element.id === question.id)) + slides.value.go( + questions.value.findIndex((element) => element.id === question.id) + ); } @@ -131,14 +135,22 @@ function geQuestionSlide(question) {
- Aucun score peut vous être proposé, vous devez faire une selection sur les vecteurs suivants : + Aucun score peut vous être proposé, vous devez faire une selection + sur les vecteurs suivants :