Fausto Busuito commited on
Commit
45d7462
1 Parent(s): 0d1bedf

Application changes

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -45,9 +45,13 @@ def quiz():
45
  if session['current_question'] >= len(session['questions']):
46
  return redirect(url_for('results'))
47
 
48
- return render_template('quiz.html', question=session['questions'][session['current_question']],
49
- question_number=session['current_question'] + 1,
50
- total_questions=len(session['questions']))
 
 
 
 
51
 
52
  @app.route('/results')
53
  def results():
 
45
  if session['current_question'] >= len(session['questions']):
46
  return redirect(url_for('results'))
47
 
48
+ # Ensure current_question is within the valid range
49
+ if session['current_question'] < len(session['questions']):
50
+ return render_template('quiz.html', question=session['questions'][session['current_question']],
51
+ question_number=session['current_question'] + 1,
52
+ total_questions=len(session['questions']))
53
+ else:
54
+ return redirect(url_for('results'))
55
 
56
  @app.route('/results')
57
  def results():