Sina Media Lab commited on
Commit
c274a12
·
1 Parent(s): edfbd88
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -25,6 +25,8 @@ if 'selected_answer' not in st.session_state:
25
  st.session_state.selected_answer = None
26
  if 'answered' not in st.session_state:
27
  st.session_state.answered = False
 
 
28
 
29
  def reset_pdf_cache():
30
  st.session_state.pdf_data = None
@@ -133,6 +135,7 @@ if selected_module != st.session_state.current_module:
133
  st.session_state.module_correct_count[selected_module] = 0
134
  st.session_state.selected_answer = None
135
  st.session_state.answered = False
 
136
 
137
  # Load the current module's question
138
  current_question = st.session_state.questions[st.session_state.current_index]
@@ -162,6 +165,9 @@ with col3:
162
 
163
  st.write(current_question["question"])
164
 
 
 
 
165
  # Create the form for the question
166
  with st.form(key=f'question_form_{st.session_state.current_index}'):
167
  selected_answer = st.radio(
@@ -178,6 +184,8 @@ if submit_button:
178
  if selected_answer is None:
179
  st.warning("Please select an option before submitting.")
180
  else:
 
 
181
  if not current_question['answered']:
182
  # Process the answer
183
  current_question['selected'] = selected_answer
 
25
  st.session_state.selected_answer = None
26
  if 'answered' not in st.session_state:
27
  st.session_state.answered = False
28
+ if 'submit_click_count' not in st.session_state:
29
+ st.session_state.submit_click_count = 0 # Initialize click counter
30
 
31
  def reset_pdf_cache():
32
  st.session_state.pdf_data = None
 
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]
 
165
 
166
  st.write(current_question["question"])
167
 
168
+ # Display the Submit/Next click count
169
+ st.write(f"Submit/Next button clicked {st.session_state.submit_click_count} time(s).")
170
+
171
  # Create the form for the question
172
  with st.form(key=f'question_form_{st.session_state.current_index}'):
173
  selected_answer = st.radio(
 
184
  if selected_answer is None:
185
  st.warning("Please select an option before submitting.")
186
  else:
187
+ st.session_state.submit_click_count += 1 # Increment the click counter
188
+
189
  if not current_question['answered']:
190
  # Process the answer
191
  current_question['selected'] = selected_answer