GSMEthesis commited on
Commit
b2ae831
·
verified ·
1 Parent(s): 09dbbf6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -13
app.py CHANGED
@@ -738,13 +738,12 @@ h3 {
738
  """, unsafe_allow_html=True)
739
 
740
  # ========== توابع اصلی ==========
741
- def custom_likert_slider(question, key, points=7, labels=None):
742
- # تعیین لیبل‌های پیش‌فرض اگر ارائه نشده باشند
743
- if not labels:
744
- labels = {
745
- 5: ["کاملاً مخالفم", "کاملاً موافقم"],
746
- 7: ["کاملاً مخالفم", "کاملاً موافقم"]
747
- }.get(points, ["کمترین", "بیشترین"])
748
 
749
  # مقدار پیش‌فرض (وسط طیف)
750
  default_value = st.session_state.get(key, (points + 1) // 2)
@@ -1287,12 +1286,7 @@ def random_likert_questions():
1287
 
1288
  # نمایش تمام سوالات این گروه در یک صفحه
1289
  for question in current_group['questions']:
1290
- answer = custom_likert_slider(
1291
- question=question["question"],
1292
- key=question["key"],
1293
- points=question["scale"],
1294
- labels=current_group["labels"] # استفاده از لیبل‌های گروه
1295
- )
1296
  st.session_state.answers[question["key"]] = answer
1297
 
1298
 
 
738
  """, unsafe_allow_html=True)
739
 
740
  # ========== توابع اصلی ==========
741
+ def custom_likert_slider(question_data):
742
+ """نمایش سوال لیکرت با اسلایدر نقطه‌ای و لیبل‌های سفارشی"""
743
+ question = question_data["question"]
744
+ key = question_data["key"]
745
+ points = question_data["scale"]
746
+ labels = question_data.get("labels", ["کمترین", "بیشترین"]) # لیبل‌های پیش‌فرض
 
747
 
748
  # مقدار پیش‌فرض (وسط طیف)
749
  default_value = st.session_state.get(key, (points + 1) // 2)
 
1286
 
1287
  # نمایش تمام سوالات این گروه در یک صفحه
1288
  for question in current_group['questions']:
1289
+ answer = custom_likert_slider(question)
 
 
 
 
 
1290
  st.session_state.answers[question["key"]] = answer
1291
 
1292