fixed missing ai_user category

This commit is contained in:
2026-02-03 21:13:29 +01:00
parent 36280a6ff8
commit a35670aa72
4 changed files with 22 additions and 13 deletions

View File

@@ -879,40 +879,42 @@ class QualtricsSurvey(QualtricsPlotsMixin):
"""
# Apply filters - skip if empty list (columns with all NULLs produce empty options)
# OR if all options are selected (to avoid dropping NULLs)
self.filter_age = age
if age is not None and len(age) > 0:
if age is not None and len(age) > 0 and set(age) != set(self.options_age):
q = q.filter(pl.col('QID1').is_in(age))
self.filter_gender = gender
if gender is not None and len(gender) > 0:
if gender is not None and len(gender) > 0 and set(gender) != set(self.options_gender):
q = q.filter(pl.col('QID2').is_in(gender))
self.filter_consumer = consumer
if consumer is not None and len(consumer) > 0:
if consumer is not None and len(consumer) > 0 and set(consumer) != set(self.options_consumer):
q = q.filter(pl.col('Consumer').is_in(consumer))
self.filter_ethnicity = ethnicity
if ethnicity is not None and len(ethnicity) > 0:
if ethnicity is not None and len(ethnicity) > 0 and set(ethnicity) != set(self.options_ethnicity):
q = q.filter(pl.col('QID3').is_in(ethnicity))
self.filter_income = income
if income is not None and len(income) > 0:
if income is not None and len(income) > 0 and set(income) != set(self.options_income):
q = q.filter(pl.col('QID15').is_in(income))
self.filter_business_owner = business_owner
if business_owner is not None and len(business_owner) > 0:
if business_owner is not None and len(business_owner) > 0 and set(business_owner) != set(self.options_business_owner):
q = q.filter(pl.col('QID4').is_in(business_owner))
self.filter_ai_user = ai_user
if ai_user is not None and len(ai_user) > 0:
if ai_user is not None and len(ai_user) > 0 and set(ai_user) != set(self.options_ai_user):
q = q.filter(pl.col('QID22').is_in(ai_user))
self.filter_investable_assets = investable_assets
if investable_assets is not None and len(investable_assets) > 0:
if investable_assets is not None and len(investable_assets) > 0 and set(investable_assets) != set(self.options_investable_assets):
q = q.filter(pl.col('QID16').is_in(investable_assets))
self.filter_industry = industry
if industry is not None and len(industry) > 0:
if industry is not None and len(industry) > 0 and set(industry) != set(self.options_industry):
q = q.filter(pl.col('QID17').is_in(industry))
self.data_filtered = q