First version not end
Browse files- __pycache__/backend.cpython-312.pyc +0 -0
- app.py +1 -0
- static/script.js +8 -3
- templates/host.html +3 -2
__pycache__/backend.cpython-312.pyc
CHANGED
Binary files a/__pycache__/backend.cpython-312.pyc and b/__pycache__/backend.cpython-312.pyc differ
|
|
app.py
CHANGED
@@ -60,6 +60,7 @@ def select_exam(data):
|
|
60 |
|
61 |
@socketio.on('restart_quiz')
|
62 |
def restart_quiz():
|
|
|
63 |
start_quiz()
|
64 |
|
65 |
def start_quiz():
|
|
|
60 |
|
61 |
@socketio.on('restart_quiz')
|
62 |
def restart_quiz():
|
63 |
+
reset_quiz()
|
64 |
start_quiz()
|
65 |
|
66 |
def start_quiz():
|
static/script.js
CHANGED
@@ -25,14 +25,19 @@ function submitForm(event) {
|
|
25 |
|
26 |
function selectExam() {
|
27 |
const examName = document.getElementById('exam-selector').value;
|
28 |
-
const startQuestion = document.getElementById('start-question').value;
|
29 |
socket.emit('select_exam', { exam_name: examName, start_question: parseInt(startQuestion) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
socket.on('exam_loaded', (data) => {
|
33 |
if (data.success) {
|
34 |
-
document.getElementById('question-count').textContent =
|
35 |
-
`Exam "${data.exam_name}" loaded with ${data.num_questions} questions. Starting from question ${data.start_question}.`;
|
36 |
alert(`Exam "${data.exam_name}" loaded successfully!`);
|
37 |
} else {
|
38 |
alert(`Failed to load exam "${data.exam_name}".`);
|
|
|
25 |
|
26 |
function selectExam() {
|
27 |
const examName = document.getElementById('exam-selector').value;
|
28 |
+
const startQuestion = document.getElementById('start-question-number').value;
|
29 |
socket.emit('select_exam', { exam_name: examName, start_question: parseInt(startQuestion) });
|
30 |
+
document.getElementById('question-start-display').textContent = `Starting from question ${startQuestion}.`;
|
31 |
+
}
|
32 |
+
|
33 |
+
function updateSliderValue(value) {
|
34 |
+
document.getElementById('start-question').value = value;
|
35 |
+
document.getElementById('start-question-number').value = value;
|
36 |
+
document.getElementById('question-start-display').textContent = `Starting from question ${value}.`;
|
37 |
}
|
38 |
|
39 |
socket.on('exam_loaded', (data) => {
|
40 |
if (data.success) {
|
|
|
|
|
41 |
alert(`Exam "${data.exam_name}" loaded successfully!`);
|
42 |
} else {
|
43 |
alert(`Failed to load exam "${data.exam_name}".`);
|
templates/host.html
CHANGED
@@ -17,9 +17,10 @@
|
|
17 |
<option value="{{ exam }}">{{ exam }}</option>
|
18 |
{% endfor %}
|
19 |
</select>
|
20 |
-
<p id="question-count" style="margin-top: 15px;"></p>
|
21 |
<label for="start-question" class="mt-3">Select starting question:</label>
|
22 |
-
<input type="range" id="start-question" min="1" max="10" value="1" class="form-range mt-2 mb-
|
|
|
|
|
23 |
<button onclick="restartQuiz()" class="btn btn-success mt-3">Start New Quiz</button><br><br>
|
24 |
<button onclick="checkAnswers()" class="btn btn-primary mt-2">Check Answers</button><br><br>
|
25 |
<button onclick="nextQuestion()" class="btn btn-secondary mt-2">Next Question</button><br><br>
|
|
|
17 |
<option value="{{ exam }}">{{ exam }}</option>
|
18 |
{% endfor %}
|
19 |
</select>
|
|
|
20 |
<label for="start-question" class="mt-3">Select starting question:</label>
|
21 |
+
<input type="range" id="start-question" min="1" max="10" value="1" class="form-range mt-2 mb-2" oninput="updateSliderValue(this.value)">
|
22 |
+
<input type="number" id="start-question-number" min="1" max="10" value="1" class="form-control" oninput="updateSliderValue(this.value)">
|
23 |
+
<p id="question-start-display" class="mt-2">Starting from question 1.</p>
|
24 |
<button onclick="restartQuiz()" class="btn btn-success mt-3">Start New Quiz</button><br><br>
|
25 |
<button onclick="checkAnswers()" class="btn btn-primary mt-2">Check Answers</button><br><br>
|
26 |
<button onclick="nextQuestion()" class="btn btn-secondary mt-2">Next Question</button><br><br>
|