GSMEthesis commited on
Commit
42e4bc3
·
verified ·
1 Parent(s): 67eb5ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -1192,9 +1192,8 @@ def random_likert_questions():
1192
  else:
1193
  st.session_state.current_page = "explanation_questions"
1194
  st.rerun()
1195
-
1196
  def explanation_questions():
1197
- """نمایش سوالات تکمیلی به صورت مرحله‌ای با دکمه ادامه"""
1198
  st.markdown("### 📋 سوالات تکمیلی")
1199
 
1200
  questions = [
@@ -1252,13 +1251,12 @@ def explanation_questions():
1252
 
1253
  current_q = questions[step]
1254
 
1255
- # بررسی شرط (مثلاً توضیح فقط اگر قبلاً بله گفته)
1256
  if "condition" in current_q and not current_q["condition"]():
1257
  st.session_state.explanation_step += 1
1258
  st.rerun()
1259
  return
1260
 
1261
- # سوال و رادیو باتن
1262
  response = st.radio(
1263
  current_q["label"],
1264
  current_q["options"],
@@ -1272,15 +1270,10 @@ def explanation_questions():
1272
  else:
1273
  logical_key = current_q["logical_key"]
1274
  st.session_state[logical_key] = response
1275
-
1276
- # اگر سوال آخره، نریم مرحله بعد. فقط صفحه بعد رو مشخص کن
1277
- if step == len(questions) - 1:
1278
- st.session_state.current_page = "demographic"
1279
- else:
1280
- st.session_state.explanation_step += 1
1281
-
1282
- st.rerun()
1283
 
 
 
 
1284
 
1285
  def demographic_form():
1286
  """فرم اطلاعات دموگرافیک"""
 
1192
  else:
1193
  st.session_state.current_page = "explanation_questions"
1194
  st.rerun()
1195
+
1196
  def explanation_questions():
 
1197
  st.markdown("### 📋 سوالات تکمیلی")
1198
 
1199
  questions = [
 
1251
 
1252
  current_q = questions[step]
1253
 
1254
+ # بررسی شرط و فقط رد شدن زمانی که کاربر دکمه زده
1255
  if "condition" in current_q and not current_q["condition"]():
1256
  st.session_state.explanation_step += 1
1257
  st.rerun()
1258
  return
1259
 
 
1260
  response = st.radio(
1261
  current_q["label"],
1262
  current_q["options"],
 
1270
  else:
1271
  logical_key = current_q["logical_key"]
1272
  st.session_state[logical_key] = response
 
 
 
 
 
 
 
 
1273
 
1274
+ # فقط رفتن به مرحله بعد یا صفحه بعد وقتی دکمه زده شد
1275
+ st.session_state.explanation_step += 1
1276
+ st.rerun()
1277
 
1278
  def demographic_form():
1279
  """فرم اطلاعات دموگرافیک"""