Fausto Busuito
commited on
Commit
•
97bf624
1
Parent(s):
de7c6d8
Application changes
Browse files- templates/quiz.html +18 -7
templates/quiz.html
CHANGED
@@ -5,17 +5,28 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Quiz</title>
|
7 |
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
</head>
|
9 |
-
<body>
|
10 |
-
<
|
11 |
-
<span>Time Elapsed: {{ elapsed_time }}</span>
|
12 |
-
</div>
|
13 |
-
<h1>Question {{ question_number }} of {{ total_questions }} - {{ selected_file }}</h1>
|
14 |
<p>{{ question.question }}</p>
|
15 |
<form action="{{ url_for('quiz') }}" method="post">
|
16 |
{% for option in question.options %}
|
17 |
-
<
|
18 |
-
|
|
|
|
|
19 |
{% endfor %}
|
20 |
<br>
|
21 |
{% if show_previous %}
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Quiz</title>
|
7 |
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
8 |
+
<script>
|
9 |
+
function updateTimer() {
|
10 |
+
const startTime = {{ session['start_time'] }} * 1000;
|
11 |
+
const now = new Date().getTime();
|
12 |
+
const elapsedTime = new Date(now - startTime);
|
13 |
+
const hours = elapsedTime.getUTCHours().toString().padStart(2, '0');
|
14 |
+
const minutes = elapsedTime.getUTCMinutes().toString().padStart(2, '0');
|
15 |
+
const seconds = elapsedTime.getUTCSeconds().toString().padStart(2, '0');
|
16 |
+
document.getElementById('timer').innerText = `${hours}:${minutes}:${seconds}`;
|
17 |
+
}
|
18 |
+
setInterval(updateTimer, 1000);
|
19 |
+
</script>
|
20 |
</head>
|
21 |
+
<body onload="updateTimer()">
|
22 |
+
<h1>Question {{ question_number }} of {{ total_questions }} - {{ selected_file }} <span id="timer"></span></h1>
|
|
|
|
|
|
|
23 |
<p>{{ question.question }}</p>
|
24 |
<form action="{{ url_for('quiz') }}" method="post">
|
25 |
{% for option in question.options %}
|
26 |
+
<label style="display: flex; align-items: center;">
|
27 |
+
<input type="checkbox" name="answer" value="{{ loop.index }}" {% if not multiple_selection %}required{% endif %}>
|
28 |
+
<span>{{ option }}</span>
|
29 |
+
</label><br>
|
30 |
{% endfor %}
|
31 |
<br>
|
32 |
{% if show_previous %}
|