Fausto Busuito commited on
Commit
528f8fc
1 Parent(s): 90e32d4

Application changes

Browse files
Files changed (1) hide show
  1. app/static/script.js +6 -1
app/static/script.js CHANGED
@@ -31,7 +31,9 @@ function displayQuestion() {
31
  document.getElementById('question-number').innerText = `Question ${currentIndex + 1} of ${questions.length}`;
32
  document.getElementById('question').innerText = question.question;
33
 
34
- const isMultipleChoice = /Select TWO|Choose two/i.test(question.question);
 
 
35
  const optionsDiv = document.getElementById('options');
36
  optionsDiv.innerHTML = '';
37
 
@@ -71,6 +73,7 @@ function displayQuestion() {
71
 
72
 
73
 
 
74
  function selectAnswer(optionIndex) {
75
  const currentAnswers = userAnswers[currentIndex];
76
  if (currentAnswers.includes(optionIndex)) {
@@ -169,6 +172,7 @@ document.getElementById('end-session').addEventListener('click', () => {
169
 
170
  // Aggiungi la tabella ai risultati
171
  const resultsContainer = document.getElementById('results-container');
 
172
  resultsContainer.appendChild(resultsTable);
173
 
174
  // Mostra il contenitore dei risultati e nascondi il quiz
@@ -177,6 +181,7 @@ document.getElementById('end-session').addEventListener('click', () => {
177
  });
178
 
179
 
 
180
  document.getElementById('restart').addEventListener('click', () => {
181
  document.getElementById('results-container').style.display = 'none';
182
  document.getElementById('file-selection').style.display = 'block';
 
31
  document.getElementById('question-number').innerText = `Question ${currentIndex + 1} of ${questions.length}`;
32
  document.getElementById('question').innerText = question.question;
33
 
34
+ // Verifica se ci sono risposte multiple
35
+ const isMultipleChoice = question.correct.length > 1;
36
+
37
  const optionsDiv = document.getElementById('options');
38
  optionsDiv.innerHTML = '';
39
 
 
73
 
74
 
75
 
76
+
77
  function selectAnswer(optionIndex) {
78
  const currentAnswers = userAnswers[currentIndex];
79
  if (currentAnswers.includes(optionIndex)) {
 
172
 
173
  // Aggiungi la tabella ai risultati
174
  const resultsContainer = document.getElementById('results-container');
175
+ resultsContainer.innerHTML = ''; // Pulisci i risultati precedenti
176
  resultsContainer.appendChild(resultsTable);
177
 
178
  // Mostra il contenitore dei risultati e nascondi il quiz
 
181
  });
182
 
183
 
184
+
185
  document.getElementById('restart').addEventListener('click', () => {
186
  document.getElementById('results-container').style.display = 'none';
187
  document.getElementById('file-selection').style.display = 'block';