Spaces:
Paused

GSMEthesis commited on
Commit
2ba95ee
·
verified ·
1 Parent(s): 76d5c98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -1277,12 +1277,22 @@ def random_likert_questions():
1277
  button_label = "ادامه به گروه بعدی" if st.session_state.current_likert_group < len(question_groups)-1 else "اتمام پرسشنامه"
1278
 
1279
  if st.button(button_label):
1280
- if st.session_state.current_likert_group < len(question_groups) - 1:
1281
- st.session_state.current_likert_group += 1
1282
- st.rerun()
 
 
 
 
 
 
1283
  else:
1284
- st.session_state.current_page = "explanation_questions"
1285
- st.rerun()
 
 
 
 
1286
 
1287
  def explanation_questions():
1288
  """نمایش سوالات تکمیلی به صورت مرحله‌ای با دکمه ادامه"""
 
1277
  button_label = "ادامه به گروه بعدی" if st.session_state.current_likert_group < len(question_groups)-1 else "اتمام پرسشنامه"
1278
 
1279
  if st.button(button_label):
1280
+ # بررسی آیا همه سوالات این گروه پاسخ داده شده‌اند
1281
+ all_answered = all(
1282
+ question["key"] in st.session_state.answers and
1283
+ st.session_state.answers[question["key"]] is not None
1284
+ for question in current_group['questions']
1285
+ )
1286
+
1287
+ if not all_answered:
1288
+ st.error("لطفاً به تمام سوالات این بخش پاسخ دهید قبل از ادامه")
1289
  else:
1290
+ if st.session_state.current_likert_group < len(question_groups) - 1:
1291
+ st.session_state.current_likert_group += 1
1292
+ st.rerun()
1293
+ else:
1294
+ st.session_state.current_page = "explanation_questions"
1295
+ st.rerun()
1296
 
1297
  def explanation_questions():
1298
  """نمایش سوالات تکمیلی به صورت مرحله‌ای با دکمه ادامه"""