Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1195,7 +1195,7 @@ def random_likert_questions():
|
|
| 1195 |
|
| 1196 |
|
| 1197 |
def explanation_questions():
|
| 1198 |
-
"""نمایش سوالات تکمیلی به صورت مرحلهای
|
| 1199 |
st.markdown("### 📋 سوالات تکمیلی")
|
| 1200 |
|
| 1201 |
questions = [
|
|
@@ -1245,14 +1245,14 @@ def explanation_questions():
|
|
| 1245 |
if current_step < len(questions):
|
| 1246 |
q = questions[current_step]
|
| 1247 |
|
| 1248 |
-
#
|
| 1249 |
if "condition" in q and not q["condition"]():
|
| 1250 |
st.session_state.explanation_step += 1
|
| 1251 |
st.rerun()
|
| 1252 |
return
|
| 1253 |
|
| 1254 |
# نمایش سوال فعلی
|
| 1255 |
-
|
| 1256 |
q["label"],
|
| 1257 |
q["options"],
|
| 1258 |
index=None,
|
|
@@ -1260,15 +1260,13 @@ def explanation_questions():
|
|
| 1260 |
)
|
| 1261 |
|
| 1262 |
if st.button("ادامه", key=f"continue_{current_step}"):
|
| 1263 |
-
if
|
| 1264 |
st.warning("لطفاً یک گزینه را انتخاب کنید")
|
| 1265 |
else:
|
| 1266 |
-
# ذخیره پاسخ (مطمئن شو که همیشه ذخیره میشه)
|
| 1267 |
-
st.session_state[q["key"]] = response
|
| 1268 |
st.session_state.explanation_step += 1
|
| 1269 |
st.rerun()
|
| 1270 |
else:
|
| 1271 |
-
# مرحله آخر: ذخیره د
|
| 1272 |
st.session_state.trust = st.session_state.get("trust_radio")
|
| 1273 |
st.session_state.pricing_method = st.session_state.get("pricing_method_radio")
|
| 1274 |
st.session_state.price_increase = st.session_state.get("price_increase_radio")
|
|
@@ -1277,10 +1275,8 @@ def explanation_questions():
|
|
| 1277 |
st.session_state.get("explanation_type_radio") if st.session_state.explanation_received == "بله" else "N/A"
|
| 1278 |
)
|
| 1279 |
|
| 1280 |
-
# رفتن به صفحه بعدی
|
| 1281 |
st.session_state.current_page = "demographic"
|
| 1282 |
st.rerun()
|
| 1283 |
-
|
| 1284 |
|
| 1285 |
def demographic_form():
|
| 1286 |
"""فرم اطلاعات دموگرافیک"""
|
|
|
|
| 1195 |
|
| 1196 |
|
| 1197 |
def explanation_questions():
|
| 1198 |
+
"""نمایش سوالات تکمیلی به صورت مرحلهای با دکمه ادامه"""
|
| 1199 |
st.markdown("### 📋 سوالات تکمیلی")
|
| 1200 |
|
| 1201 |
questions = [
|
|
|
|
| 1245 |
if current_step < len(questions):
|
| 1246 |
q = questions[current_step]
|
| 1247 |
|
| 1248 |
+
# اگر شرط خاصی داره (مثل سوال پنجم)، بررسیش کن
|
| 1249 |
if "condition" in q and not q["condition"]():
|
| 1250 |
st.session_state.explanation_step += 1
|
| 1251 |
st.rerun()
|
| 1252 |
return
|
| 1253 |
|
| 1254 |
# نمایش سوال فعلی
|
| 1255 |
+
st.radio(
|
| 1256 |
q["label"],
|
| 1257 |
q["options"],
|
| 1258 |
index=None,
|
|
|
|
| 1260 |
)
|
| 1261 |
|
| 1262 |
if st.button("ادامه", key=f"continue_{current_step}"):
|
| 1263 |
+
if st.session_state.get(q["key"]) is None:
|
| 1264 |
st.warning("لطفاً یک گزینه را انتخاب کنید")
|
| 1265 |
else:
|
|
|
|
|
|
|
| 1266 |
st.session_state.explanation_step += 1
|
| 1267 |
st.rerun()
|
| 1268 |
else:
|
| 1269 |
+
# مرحله آخر: ذخیره دادهها و رفتن به فرم دموگرافیک
|
| 1270 |
st.session_state.trust = st.session_state.get("trust_radio")
|
| 1271 |
st.session_state.pricing_method = st.session_state.get("pricing_method_radio")
|
| 1272 |
st.session_state.price_increase = st.session_state.get("price_increase_radio")
|
|
|
|
| 1275 |
st.session_state.get("explanation_type_radio") if st.session_state.explanation_received == "بله" else "N/A"
|
| 1276 |
)
|
| 1277 |
|
|
|
|
| 1278 |
st.session_state.current_page = "demographic"
|
| 1279 |
st.rerun()
|
|
|
|
| 1280 |
|
| 1281 |
def demographic_form():
|
| 1282 |
"""فرم اطلاعات دموگرافیک"""
|