Skip to content

Commit

Permalink
chore: only filter datasets on dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Mar 18, 2024
1 parent 05ef907 commit cbf3bf9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ with grades as (
from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_grades
where grade_type = 'course'
{% raw %}
{% if get_filters('course_name', remove_filter=True) != [] and filter_values('course_name') != [] %}
{% if get_filters('course_name', remove_filter=True) == [] %}
{% elif filter_values('course_name') != [] %}
and entity_name in {{ filter_values('course_name', remove_filter=True) | where_in }}
{% else %}
and 1=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ SELECT
FROM summary
WHERE
{% raw %}
{% if get_filters('course_name', remove_filter=True) != [] and filter_values('course_name') != [] %}
{% if get_filters('course_name', remove_filter=True) == [] %}
{% elif filter_values('course_name') != [] %}
course_name in {{ filter_values('course_name') | where_in }}
{% else %}
1=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ SELECT
FROM summary
where
{% raw %}
{% if get_filters('problem_name_with_location', remove_filter=True) != [] and filter_values('problem_name_with_location') != [] %}
{% if get_filters('problem_name_with_location', remove_filter=True) == [] %}
{% elif filter_values('problem_name_with_location') != [] %}
problem_name_with_location in {{ filter_values('problem_name_with_location') | where_in }}
{% else %}
1=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ with grades as (
grade_type = 'problem'

{% raw %}
{% if get_filters('problem_name_with_location', remove_filter=True) != [] and filter_values('problem_name_with_location') != [] %}
{% if get_filters('problem_name_with_location', remove_filter=True) != [] %}
{% elif filter_values('problem_name_with_location') != [] %}
and entity_name_with_location in {{ filter_values('problem_name_with_location', remove_filter=True) | where_in }}
{% else %}
and 1=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ from
problem_responses
where
{% raw %}
{% if get_filters('problem_name_with_location', remove_filter=True) != [] and filter_values('problem_name_with_location') != [] %}
{% if get_filters('problem_name_with_location', remove_filter=True) == [] %}
{% elif filter_values('problem_name_with_location') != [] %}
problem_name_with_location in {{ filter_values('problem_name_with_location') | where_in }}
{% else %}
1=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ select *
from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_transcript_usage
where
{% raw %}
{% if get_filters('course_name', remove_filter=True) != [] and filter_values('course_name') != [] %}
{% if get_filters('course_name', remove_filter=True) == [] %}
{% elif filter_values('course_name') != [] %}
course_name in {{ filter_values('course_name') | where_in }}
{% else %}
1=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ select *
from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_video_plays
where
{% raw %}
{% if get_filters('course_name', remove_filter=True) != [] and filter_values('course_name') != [] %}
{% if get_filters('course_name', remove_filter=True) == [] %}
{% elif filter_values('course_name') != [] %}
course_name in {{ filter_values('course_name') | where_in }}
{% else %}
1=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ select
from enriched_segments
where
{% raw %}
{% if get_filters('video_name_with_location', remove_filter=True) != [] and filter_values('video_name_with_location') != [] %}
{% if get_filters('video_name_with_location', remove_filter=True) == [] %}
{% elif filter_values('video_name_with_location') != [] %}
video_name_with_location in {{ filter_values('video_name_with_location') | where_in }}
{% else %}
1=0
Expand Down

0 comments on commit cbf3bf9

Please sign in to comment.