Spaces:
Runtime error
Runtime error
File size: 1,377 Bytes
53ce00a d8529e7 53ce00a d8529e7 53ce00a d8529e7 53ce00a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
{% extends 'base.html' %}
{% block content %}
<h1>ํด์ฆ ์์ฑ ๊ฒฐ๊ณผ</h1>
{% if quizzes %}
<ul>
{% for quiz in quizzes %}
<li>
<h2>๋ฌธ์ ์ฃผ์ธ: {{ quiz[3] }}</h2> <!-- ์ด๋ฆ ๋ถ๋ถ -->
<h3>์ง๋ฌธ: {{ quiz[0] }}</h3> <!-- ์ง๋ฌธ ๋ถ๋ถ -->
<ul>
{% for option in quiz[1] %} <!-- 4์ง์ ๋ค ๋ณด๊ธฐ -->
<li>{{ option }}</li>
{% endfor %}
</ul>
<button onclick="showAnswer('{{ loop.index0 }}')">์ ๋ต ๋ณด๊ธฐ</button>
<p id="answer-{{ loop.index0 }}" style="display: none;">์ ๋ต: {{ quiz[2] }}</p> <!-- ์ ๋ต -->
</li>
{% endfor %}
</ul>
{% else %}
<p>ํด์ฆ๊ฐ ์์ต๋๋ค. ๋ค์ ์๋ํด ์ฃผ์ธ์.</p>
{% endif %}
<script>
let currentQuizIndex = 0;
function showAnswer(index) {
const answer = document.getElementById(`answer-${index}`);
if (answer.style.display === "none") {
answer.style.display = "block";
} else {
answer.style.display = "none";
}
currentQuizIndex++;
// ํด์ฆ๋ฅผ ๋ชจ๋ ํ๊ณ ๋๋ฉด ๋ง๋ฌด๋ฆฌ ํ์ด์ง๋ก ์ด๋
if (currentQuizIndex === { length }) {
setTimeout(() => {
window.location.href = "{{ url_for('quiz.finish') }}";
}, 3000); // 3์ด ํ ์๋ ์ด๋
}
}
</script>
{% endblock %} |