Fausto Busuito
commited on
Commit
·
d0264d6
1
Parent(s):
1666eb3
Application changes
Browse files- templates/quiz.html +14 -38
templates/quiz.html
CHANGED
@@ -2,47 +2,23 @@
|
|
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
|
22 |
-
<h1>
|
23 |
-
<
|
24 |
-
|
25 |
-
{%
|
26 |
-
|
27 |
-
<
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
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
|
46 |
</form>
|
|
|
|
|
47 |
</body>
|
48 |
</html>
|
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
|
|
5 |
<title>Quiz</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
</head>
|
7 |
+
<body>
|
8 |
+
<h1>Quiz</h1>
|
9 |
+
<form method="post">
|
10 |
+
<p>{{ question.question }}</p>
|
11 |
+
{% for i, option in enumerate(question.options) %}
|
12 |
+
<label>
|
13 |
+
<input type="checkbox" name="answer" value="{{ i }}" {% if i in previous_answers %}checked{% endif %}>
|
14 |
+
{{ option }}
|
15 |
+
</label><br>
|
16 |
+
{% endfor %}
|
17 |
+
<button type="submit" name="action" value="previous" {% if not show_previous %}disabled{% endif %}>Previous</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<button type="submit" name="action" value="next">Next</button>
|
19 |
+
<button type="submit" name="action" value="end">End Quiz</button>
|
20 |
</form>
|
21 |
+
<p>Question {{ question_number }} of {{ total_questions }}</p>
|
22 |
+
<p>Elapsed Time: {{ elapsed_time }}</p>
|
23 |
</body>
|
24 |
</html>
|