|
|
@ -8,19 +8,28 @@
|
|
|
|
<section>
|
|
|
|
<section>
|
|
|
|
<h1>Quiz</h1>
|
|
|
|
<h1>Quiz</h1>
|
|
|
|
|
|
|
|
|
|
|
|
{% if translations is defined %}
|
|
|
|
{% if translations is defined %}
|
|
|
|
{% for translation in translations %}
|
|
|
|
{% for translation in translations %}
|
|
|
|
<h2>{{ translation.word1 }}</h2>
|
|
|
|
<h2>{{ translation.word1 }}</h2>
|
|
|
|
{% set correctAnswer = translation.word2 %}
|
|
|
|
{% set correctAnswer = translation.word2 %}
|
|
|
|
{% set otherTranslations = [translation.word2, translations[0].word2, translations[1].word2, translations[2].word2] %}
|
|
|
|
{% if randomtranslations is defined %}
|
|
|
|
<input type="radio" name="answer" value="{{ correctAnswer }}"> {{ correctAnswer }}<br>
|
|
|
|
{% set otherTranslations = [correctAnswer] %}
|
|
|
|
{% for otherTranslation in otherTranslations %}
|
|
|
|
{% for randomtranslation in randomtranslations %}
|
|
|
|
{% if otherTranslation != correctAnswer %}
|
|
|
|
{% if randomtranslation.word2 != correctAnswer and otherTranslations|length <= 3 %}
|
|
|
|
<input type="radio" name="answer" value="{{ otherAnswer }}"> {{ otherAnswer }}<br>
|
|
|
|
{% set otherTranslations = otherTranslations|merge([randomtranslation.word2]) %}
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{# Affichage des réponses sous forme de radio buttons #}
|
|
|
|
|
|
|
|
<input type="radio" name="answer" value="{{ correctAnswer }}"> {{ correctAnswer }}<br>
|
|
|
|
|
|
|
|
{% for otherTranslation in otherTranslations %}
|
|
|
|
|
|
|
|
<input type="radio" name="answer" value="{{ otherTranslation }}"> {{ otherTranslation }}<br>
|
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<input type="submit" value="Submit" name="submitForm">
|
|
|
|
<input type="submit" value="Submit" name="submitForm">
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
{% if submitted %}
|
|
|
|
{% if submitted %}
|
|
|
|