Fausto Busuito
commited on
Commit
·
d795bcc
1
Parent(s):
d0264d6
Application changes
Browse files- templates/quiz.html +38 -14
templates/quiz.html
CHANGED
@@ -2,23 +2,47 @@
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
|
|
5 |
<title>Quiz</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
</head>
|
7 |
-
<body>
|
8 |
-
<h1>
|
9 |
-
<
|
10 |
-
|
11 |
-
{%
|
12 |
-
|
13 |
-
<
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<button type="submit" name="action" value="next">Next</button>
|
19 |
-
<button type="submit" name="action" value="end">End
|
20 |
</form>
|
21 |
-
<p>Question {{ question_number }} of {{ total_questions }}</p>
|
22 |
-
<p>Elapsed Time: {{ elapsed_time }}</p>
|
23 |
</body>
|
24 |
</html>
|
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
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 |
+
{% if multiple_selection %}
|
26 |
+
{% for option in question.options %}
|
27 |
+
<label style="display: flex; align-items: center;">
|
28 |
+
<input type="checkbox" name="answer" value="{{ loop.index }}" {% if loop.index in previous_answers %}checked{% endif %}>
|
29 |
+
<span>{{ option }}</span>
|
30 |
+
</label><br>
|
31 |
+
{% endfor %}
|
32 |
+
{% else %}
|
33 |
+
{% for option in question.options %}
|
34 |
+
<label style="display: flex; align-items: center;">
|
35 |
+
<input type="radio" name="answer" value="{{ loop.index }}" {% if loop.index in previous_answers %}checked{% endif %}>
|
36 |
+
<span>{{ option }}</span>
|
37 |
+
</label><br>
|
38 |
+
{% endfor %}
|
39 |
+
{% endif %}
|
40 |
+
<br>
|
41 |
+
{% if show_previous %}
|
42 |
+
<button type="submit" name="action" value="previous">Previous</button>
|
43 |
+
{% endif %}
|
44 |
<button type="submit" name="action" value="next">Next</button>
|
45 |
+
<button type="submit" name="action" value="end">End Session</button>
|
46 |
</form>
|
|
|
|
|
47 |
</body>
|
48 |
</html>
|