Sina Media Lab commited on
Commit
9935146
·
1 Parent(s): ffbf590
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -182,14 +182,15 @@ if selected_category:
182
  st.markdown("<div style='margin-top: 20px;'></div>", unsafe_allow_html=True)
183
  # Show PDF report button, initially disabled until a question is answered
184
  pdf_disabled = len(st.session_state.questions) == 0
185
- st.download_button(
186
- label="Quiz Report",
187
- data=st.session_state.pdf_data if not pdf_disabled else b'',
188
- file_name="quiz_report.pdf",
189
- mime="application/pdf",
190
- disabled=pdf_disabled,
191
- key="pdf_download_button"
192
- )
 
193
 
194
  if selected_module != st.session_state.current_module:
195
  st.session_state.current_module = selected_module
@@ -265,9 +266,6 @@ if submit_button:
265
  # Generate the PDF report data after each submission
266
  st.session_state.pdf_data = generate_pdf_report()
267
 
268
- # Generate a new question for the next round
269
- st.session_state.current_question = generate_new_question(selected_category, selected_module, selected_module_data)
270
-
271
  # Refresh the PDF button state
272
  st.download_button(
273
  label="Quiz Report",
 
182
  st.markdown("<div style='margin-top: 20px;'></div>", unsafe_allow_html=True)
183
  # Show PDF report button, initially disabled until a question is answered
184
  pdf_disabled = len(st.session_state.questions) == 0
185
+ if st.session_state.pdf_data:
186
+ st.download_button(
187
+ label="Quiz Report",
188
+ data=st.session_state.pdf_data,
189
+ file_name="quiz_report.pdf",
190
+ mime="application/pdf",
191
+ disabled=False,
192
+ key="pdf_download_button"
193
+ )
194
 
195
  if selected_module != st.session_state.current_module:
196
  st.session_state.current_module = selected_module
 
266
  # Generate the PDF report data after each submission
267
  st.session_state.pdf_data = generate_pdf_report()
268
 
 
 
 
269
  # Refresh the PDF button state
270
  st.download_button(
271
  label="Quiz Report",