Sina Media Lab commited on
Commit
7f3aa91
Β·
1 Parent(s): e6dc747
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -152,16 +152,23 @@ if selected_category:
152
  selected_module_data = module_data
153
  break
154
 
155
- # Display black background title with PDF report icon in front
156
  st.markdown(
157
  f"""
158
  <div style="background-color: #333; padding: 10px; border-radius: 5px; margin-top: 20px;">
159
  <span style='font-size: 18px; color: white;'>{selected_category} > {selected_module_data['title']}</span>
160
- <a href='#' download='quiz_report.pdf' style='font-size: 18px; margin-left: 10px; color: white;' onclick='document.getElementById("pdf-link").click();'>πŸ“„ Download PDF Report</a>
161
- </div>
162
  """,
163
  unsafe_allow_html=True
164
  )
 
 
 
 
 
 
 
 
 
165
 
166
  if selected_module != st.session_state.current_module:
167
  st.session_state.current_module = selected_module
 
152
  selected_module_data = module_data
153
  break
154
 
155
+ # Display black background title with PDF report icon, but only show the icon when at least one question is answered
156
  st.markdown(
157
  f"""
158
  <div style="background-color: #333; padding: 10px; border-radius: 5px; margin-top: 20px;">
159
  <span style='font-size: 18px; color: white;'>{selected_category} > {selected_module_data['title']}</span>
 
 
160
  """,
161
  unsafe_allow_html=True
162
  )
163
+
164
+ if len(st.session_state.questions) > 0:
165
+ st.markdown(
166
+ f"""
167
+ <a href='#' download='quiz_report.pdf' style='font-size: 18px; margin-left: 10px; color: white;' onclick='document.getElementById("pdf-link").click();'>πŸ“„ Download PDF Report</a>
168
+ </div>
169
+ """,
170
+ unsafe_allow_html=True
171
+ )
172
 
173
  if selected_module != st.session_state.current_module:
174
  st.session_state.current_module = selected_module