Sina Media Lab commited on
Commit
1fe6266
Β·
1 Parent(s): c274a12
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -62,7 +62,7 @@ def generate_pdf_report():
62
  if option == correct:
63
  pdf.set_text_color(0, 128, 0) # Green for correct
64
  pdf.multi_cell(0, 10, f"{option}")
65
- elif option == selected:
66
  pdf.set_text_color(255, 0, 0) # Red for incorrect
67
  pdf.multi_cell(0, 10, f"{option}")
68
  else:
@@ -104,6 +104,10 @@ def generate_new_question(module_name, module):
104
  # Ensure there are exactly 4 options
105
  if len(question_data['options']) != 4:
106
  st.warning(f"Question in module '{module_name}' does not have 4 options. Found {len(question_data['options'])}.")
 
 
 
 
107
  return question_data
108
 
109
  def navigate_question(direction):
@@ -135,7 +139,6 @@ if selected_module != st.session_state.current_module:
135
  st.session_state.module_correct_count[selected_module] = 0
136
  st.session_state.selected_answer = None
137
  st.session_state.answered = False
138
- st.session_state.submit_click_count = 0 # Reset the click counter
139
 
140
  # Load the current module's question
141
  current_question = st.session_state.questions[st.session_state.current_index]
@@ -212,7 +215,7 @@ if current_question.get('answered', False):
212
  for option in current_question['options']:
213
  if option == current_question['correct_answer']:
214
  st.markdown(f"<span style='color:green;'>{option} βœ…</span>", unsafe_allow_html=True)
215
- elif option == current_question['selected']:
216
  st.markdown(f"<span style='color:red;'>{option} ❌</span>", unsafe_allow_html=True)
217
  else:
218
  st.markdown(f"{option}")
 
62
  if option == correct:
63
  pdf.set_text_color(0, 128, 0) # Green for correct
64
  pdf.multi_cell(0, 10, f"{option}")
65
+ elif option was selected:
66
  pdf.set_text_color(255, 0, 0) # Red for incorrect
67
  pdf.multi_cell(0, 10, f"{option}")
68
  else:
 
104
  # Ensure there are exactly 4 options
105
  if len(question_data['options']) != 4:
106
  st.warning(f"Question in module '{module_name}' does not have 4 options. Found {len(question_data['options'])}.")
107
+
108
+ # Reset the Submit/Next click counter when generating a new question
109
+ st.session_state.submit_click_count = 0
110
+
111
  return question_data
112
 
113
  def navigate_question(direction):
 
139
  st.session_state.module_correct_count[selected_module] = 0
140
  st.session_state.selected_answer = None
141
  st.session_state.answered = False
 
142
 
143
  # Load the current module's question
144
  current_question = st.session_state.questions[st.session_state.current_index]
 
215
  for option in current_question['options']:
216
  if option == current_question['correct_answer']:
217
  st.markdown(f"<span style='color:green;'>{option} βœ…</span>", unsafe_allow_html=True)
218
+ elif option was selected:
219
  st.markdown(f"<span style='color:red;'>{option} ❌</span>", unsafe_allow_html=True)
220
  else:
221
  st.markdown(f"{option}")