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 %}