Skip to content

Commit

Permalink
Merge pull request #974 from saraburns1/testing_fixes
Browse files Browse the repository at this point in the history
fix: fix enrollment count, video count, tag filter
  • Loading branch information
Cristhian Garcia authored Oct 23, 2024
2 parents 3ffdbb9 + 117fe68 commit c981320
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ params:
groupby:
- course_name
- org
- video_count
metrics:
- num_videos
- watched_percent
- rewatched_percent
- avg_video_length
Expand Down Expand Up @@ -55,8 +55,8 @@ query_context:
groupby:
- course_name
- org
- video_count
metrics:
- num_videos
- watched_percent
- rewatched_percent
- avg_video_length
Expand All @@ -78,20 +78,20 @@ query_context:
columns:
- course_name
- org
- video_count
custom_form_data: {}
custom_params: {}
extras:
having: ''
where: ''
filters: []
metrics:
- num_videos
- watched_percent
- rewatched_percent
- avg_video_length
order_desc: true
orderby:
- - watched_percent
- - num_videos
- false
post_processing: []
row_limit: 50000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ params:
groupby:
- course_run
- course_name
- video_count
metrics:
- num_videos
- watched_percent
- rewatched_percent
- avg_video_length
Expand Down Expand Up @@ -55,8 +55,8 @@ query_context:
groupby:
- course_run
- course_name
- video_count
metrics:
- num_videos
- watched_percent
- rewatched_percent
- avg_video_length
Expand All @@ -78,20 +78,20 @@ query_context:
columns:
- course_run
- course_name
- video_count
custom_form_data: {}
custom_params: {}
extras:
having: ''
where: ''
filters: []
metrics:
- num_videos
- watched_percent
- rewatched_percent
- avg_video_length
order_desc: true
orderby:
- - watched_percent
- - num_videos
- false
post_processing: []
row_limit: 50000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ metrics:
- currency: null
d3format: null
description: null
expression: uniq((active_learner,course_run))
expression: uniq(active_learner,course_run)
extra:
warning_markdown: ''
metric_name: active_count
Expand All @@ -125,7 +125,7 @@ metrics:
- currency: null
d3format: null
description: null
expression: uniq((actor_id,course_run))
expression: uniq(actor_id,course_run)
extra:
warning_markdown: ''
metric_name: enrollees
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ columns:
python_date_format: null
type: String
verbose_name: Tag
- advanced_data_type: null
column_name: course_key
description: null
expression: null
extra: {}
filterable: true
groupby: true
is_active: true
is_dttm: false
python_date_format: null
type: String
verbose_name: Course Key
database_uuid: 21174b6c-4d40-4958-8161-d6c3cf5e77b6
default_endpoint: null
description: null
Expand All @@ -50,7 +62,8 @@ metrics:
d3format: null
description: null
expression: COUNT(*)
extra: {}
extra:
warning_markdown: ''
metric_name: count
metric_type: count
verbose_name: COUNT(*)
Expand All @@ -59,7 +72,8 @@ metrics:
d3format: null
description: null
expression: min(rownum)
extra: {}
extra:
warning_markdown: ''
metric_name: order
metric_type: null
verbose_name: order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@ _file_name: watched_video_duration.yaml
always_filter_main_dttm: false
cache_timeout: null
columns:
- advanced_data_type: null
column_name: video_count
description: null
expression: null
extra:
warning_markdown: null
filterable: true
groupby: true
is_active: true
is_dttm: false
python_date_format: null
type: UInt64
verbose_name: Number of Videos
- advanced_data_type: null
column_name: course_name
description: null
Expand Down Expand Up @@ -119,6 +106,18 @@ columns:
python_date_format: null
type: String
verbose_name: Org
- advanced_data_type: null
column_name: video_count
description: null
expression: null
extra: {}
filterable: true
groupby: true
is_active: true
is_dttm: false
python_date_format: null
type: Int32
verbose_name: Video Count
database_uuid: 21174b6c-4d40-4958-8161-d6c3cf5e77b6
default_endpoint: null
description: null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
with
data as (
select id, rownum, tag, course_key
from
(
select
id,
case when parent = 0 then id else cast(parent as int) end as sort_order_1,
case when parent = 0 then 0 else 1 end as sort_order_2,
multiIf(parent = 0, id, CAST(parent, 'int')) as sort_order_1,
multiIf(parent = 0, 0, 1) as sort_order_2,
concat(repeat('- ', countMatches(lineage, ',')), value) as tag,
row_number() over (order by sort_order_1, sort_order_2, value) as rownum
row_number() over (
order by sort_order_1 ASC, sort_order_2 ASC, value ASC
) as rownum
from {{ ASPECTS_EVENT_SINK_DATABASE }}.most_recent_tags
)
select id, rownum, tag
from data
) as t
left join
{{ DBT_PROFILE_TARGET_DATABASE }}.most_recent_course_tags ct on ct.tag_id = t.id

0 comments on commit c981320

Please sign in to comment.