GSMEthesis commited on
Commit
716adac
·
verified ·
1 Parent(s): 017e669

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -1193,7 +1193,6 @@ def random_likert_questions():
1193
  st.session_state.current_page = "explanation_questions"
1194
  st.rerun()
1195
 
1196
-
1197
  def explanation_questions():
1198
  """نمایش سوالات تکمیلی به صورت مرحله‌ای با دکمه ادامه"""
1199
  st.markdown("### 📋 سوالات تکمیلی")
@@ -1241,28 +1240,25 @@ def explanation_questions():
1241
  }
1242
  ]
1243
 
1244
- # مرحله فعلی
1245
  if "explanation_step" not in st.session_state:
1246
  st.session_state.explanation_step = 0
1247
 
1248
  step = st.session_state.explanation_step
1249
 
1250
- # وقتی همه سوالات تمام شدند
1251
  if step >= len(questions):
1252
- if st.button("اتمام و ادامه"):
1253
- st.session_state.current_page = "demographic"
1254
- st.rerun()
1255
  return
1256
 
1257
  current_q = questions[step]
1258
 
1259
- # اگر شرط خاصی داره (مثل سوال پنجم)، بررسیش کن
1260
  if "condition" in current_q and not current_q["condition"]():
1261
  st.session_state.explanation_step += 1
1262
  st.rerun()
1263
  return
1264
 
1265
- # نمایش سوال
1266
  response = st.radio(
1267
  current_q["label"],
1268
  current_q["options"],
@@ -1274,11 +1270,11 @@ def explanation_questions():
1274
  if response is None:
1275
  st.warning("لطفاً یک گزینه را انتخاب کنید")
1276
  else:
1277
- # ذخیره پاسخ فعلی
1278
  logical_key = current_q["logical_key"]
1279
  st.session_state[logical_key] = response
1280
  st.session_state.explanation_step += 1
1281
  st.rerun()
 
1282
 
1283
  def demographic_form():
1284
  """فرم اطلاعات دموگرافیک"""
 
1193
  st.session_state.current_page = "explanation_questions"
1194
  st.rerun()
1195
 
 
1196
  def explanation_questions():
1197
  """نمایش سوالات تکمیلی به صورت مرحله‌ای با دکمه ادامه"""
1198
  st.markdown("### 📋 سوالات تکمیلی")
 
1240
  }
1241
  ]
1242
 
 
1243
  if "explanation_step" not in st.session_state:
1244
  st.session_state.explanation_step = 0
1245
 
1246
  step = st.session_state.explanation_step
1247
 
 
1248
  if step >= len(questions):
1249
+ st.session_state.current_page = "demographic"
1250
+ st.rerun()
 
1251
  return
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"],
 
1270
  if response is None:
1271
  st.warning("لطفاً یک گزینه را انتخاب کنید")
1272
  else:
 
1273
  logical_key = current_q["logical_key"]
1274
  st.session_state[logical_key] = response
1275
  st.session_state.explanation_step += 1
1276
  st.rerun()
1277
+
1278
 
1279
  def demographic_form():
1280
  """فرم اطلاعات دموگرافیک"""