Sina Media Lab commited on
Commit
39b3461
·
1 Parent(s): ed58d81
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -57,7 +57,7 @@ def generate_pdf_report():
57
  )
58
  pdf.multi_cell(0, 10, f"Q: {question}")
59
  for option in options:
60
- if option == correct:
61
  pdf.set_text_color(0, 128, 0) # Green for correct
62
  pdf.multi_cell(0, 10, f"{option}")
63
  elif option == selected:
@@ -111,8 +111,8 @@ def navigate_question(direction):
111
  new_question = generate_new_question(st.session_state.current_module, modules[st.session_state.current_module])
112
  st.session_state.questions.append(new_question)
113
  st.session_state.current_index = len(st.session_state.questions) - 1
114
- # Triggering UI update by setting a session state variable
115
- st.session_state.new_question_trigger = not st.session_state.get('new_question_trigger', False)
116
 
117
  # Load all modules dynamically
118
  modules = load_modules()
@@ -211,4 +211,4 @@ if st.button("Go!"):
211
 
212
  elif action == "New":
213
  navigate_question("new")
214
- st.experimental_set_query_params(dummy="1") # Forces the app to rerun and show the new question immediately
 
57
  )
58
  pdf.multi_cell(0, 10, f"Q: {question}")
59
  for option in options:
60
+ if option was correct:
61
  pdf.set_text_color(0, 128, 0) # Green for correct
62
  pdf.multi_cell(0, 10, f"{option}")
63
  elif option == selected:
 
111
  new_question = generate_new_question(st.session_state.current_module, modules[st.session_state.current_module])
112
  st.session_state.questions.append(new_question)
113
  st.session_state.current_index = len(st.session_state.questions) - 1
114
+ # Triggering UI update naturally through session state change
115
+ st.session_state.refresh = not st.session_state.get('refresh', False)
116
 
117
  # Load all modules dynamically
118
  modules = load_modules()
 
211
 
212
  elif action == "New":
213
  navigate_question("new")
214
+ st.session_state.dummy = not st.session_state.get('dummy', False) # Force a UI refresh