diff --git a/flask_base/data/quizz.json b/flask_base/data/quizz.json index 1d8db8a..e92afa4 100644 --- a/flask_base/data/quizz.json +++ b/flask_base/data/quizz.json @@ -1,26 +1,39 @@ -[ - { - "question" : "coucou", - "nb" : 1, - "answer" : [ - { - "answer" : "salut", - "nb" : 1 - } - ] - }, - { - "question" : "hello", - "nb" : 2, - "answer" : [ - { - "answer" : "salut", - "nb" : 1 - }, - { - "answer" : "deux", - "nb" : 2 - } - ] - } -] +{ + "nbQuestion" : 2, + "questions" : [ + { + "question" : "coucou", + "nb" : 1, + "nbAnswer" : 2, + "answer" : [ + { + "answer" : "salut", + "nb" : 1, + "correct" : "true" + }, + { + "answer" : "de", + "nb" : 2, + "correct" : "false" + } + ] + }, + { + "question" : "hello", + "nb" : 2, + "nbAnswer" : 2, + "answer" : [ + { + "answer" : "salut", + "nb" : 1, + "correct" : "false" + }, + { + "answer" : "deux", + "nb" : 2, + "correct" : "true" + } + ] + } + ] +} \ No newline at end of file diff --git a/flask_base/static/quizz.js b/flask_base/static/quizz.js index 009e425..5419352 100644 --- a/flask_base/static/quizz.js +++ b/flask_base/static/quizz.js @@ -5,18 +5,27 @@ function test() document.getElementById("demo").innerHTML = "Title!"; } var nextquestion; -function startQuiz() +var nbQuestion; +function startQuiz(j) { nextquestion = 1; + nbQuestion = j; document.getElementById("test1").style.display = "block"; document.getElementById("strt").disabled = "true"; } -function tog() +function tog(j) { - var chk1 = document.getElementById("tgl1"+nextquestion) - var chk2 = document.getElementById("tgl2"+nextquestion) - if (chk1.checked==true && chk2.checked != true) + + var chk = []; + var test = true + for (i=0;i +{% for q in questions.questions %} +

{{q.question}}

{% for a in q.answer%} -
+
{% endfor %} - -



+ +



-{% endfor %} \ No newline at end of file +{% endfor %} diff --git a/flask_base/templates/quiz.html b/flask_base/templates/quiz.html index 91d105e..1ba8d69 100644 --- a/flask_base/templates/quiz.html +++ b/flask_base/templates/quiz.html @@ -9,7 +9,7 @@

page du quiz

- + {% include 'question.html' %}