GSMEthesis commited on
Commit
231908b
·
verified ·
1 Parent(s): bd696d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1308,15 +1308,20 @@ def random_likert_questions():
1308
  button_label = "ادامه به گروه بعدی" if st.session_state.current_likert_group < len(question_groups)-1 else "اتمام پرسشنامه"
1309
 
1310
  if st.button(button_label):
1311
- # بررسی آیا همه سوالات این گروه پاسخ داده شده‌اند
1312
  all_answered = all(
1313
  question["key"] in st.session_state.answers and
1314
  st.session_state.answers[question["key"]] is not None
1315
  for question in current_group['questions']
1316
  )
1317
 
1318
- if not all_answered:
1319
- st.error("لطفاً به تمام سوالات این بخش پاسخ دهید ")
 
 
 
 
 
1320
  else:
1321
  if st.session_state.current_likert_group < len(question_groups) - 1:
1322
  st.session_state.current_likert_group += 1
 
1308
  button_label = "ادامه به گروه بعدی" if st.session_state.current_likert_group < len(question_groups)-1 else "اتمام پرسشنامه"
1309
 
1310
  if st.button(button_label):
1311
+ # بررسی آیا همه سوالات این گروه پاسخ داده شده‌اند و هیچ کدام صفر نیستند
1312
  all_answered = all(
1313
  question["key"] in st.session_state.answers and
1314
  st.session_state.answers[question["key"]] is not None
1315
  for question in current_group['questions']
1316
  )
1317
 
1318
+ has_zero = any(
1319
+ st.session_state.answers.get(question["key"]) == 0
1320
+ for question in current_group['questions']
1321
+ )
1322
+
1323
+ if not all_answered or has_zero:
1324
+ st.error("لطفاً به تمام سوالات این بخش پاسخ دهید (مقدار صفر مجاز نیست)")
1325
  else:
1326
  if st.session_state.current_likert_group < len(question_groups) - 1:
1327
  st.session_state.current_likert_group += 1