Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1251,13 +1251,13 @@ def explanation_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 |
-
|
| 1261 |
current_q["label"],
|
| 1262 |
current_q["options"],
|
| 1263 |
index=None,
|
|
@@ -1265,15 +1265,15 @@ def explanation_questions():
|
|
| 1265 |
)
|
| 1266 |
|
| 1267 |
if st.button("ادامه", key=f"continue_{step}"):
|
|
|
|
| 1268 |
if response is None:
|
| 1269 |
st.warning("لطفاً یک گزینه را انتخاب کنید")
|
| 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 |
"""فرم اطلاعات دموگرافیک"""
|
|
|
|
| 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 |
+
st.radio(
|
| 1261 |
current_q["label"],
|
| 1262 |
current_q["options"],
|
| 1263 |
index=None,
|
|
|
|
| 1265 |
)
|
| 1266 |
|
| 1267 |
if st.button("ادامه", key=f"continue_{step}"):
|
| 1268 |
+
response = st.session_state.get(current_q["key"]) # مهم: از session_state بگیر
|
| 1269 |
if response is None:
|
| 1270 |
st.warning("لطفاً یک گزینه را انتخاب کنید")
|
| 1271 |
else:
|
| 1272 |
logical_key = current_q["logical_key"]
|
| 1273 |
st.session_state[logical_key] = response
|
|
|
|
|
|
|
| 1274 |
st.session_state.explanation_step += 1
|
| 1275 |
st.rerun()
|
| 1276 |
+
|
| 1277 |
|
| 1278 |
def demographic_form():
|
| 1279 |
"""فرم اطلاعات دموگرافیک"""
|