From 48e7af5e444e4cfca55be86f4b75c2b44e600de0 Mon Sep 17 00:00:00 2001 From: Sara Burns Date: Fri, 6 Sep 2024 15:15:54 -0400 Subject: [PATCH] fix: formatting --- .../queries/course_information.sql | 4 +++- .../queries/learner_performance_breakdown.sql | 24 ++++++++++++------- .../queries/tag_filter_dataset.sql | 21 +++++++++------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/tutoraspects/templates/openedx-assets/queries/course_information.sql b/tutoraspects/templates/openedx-assets/queries/course_information.sql index 410361ecf..9d6f53351 100644 --- a/tutoraspects/templates/openedx-assets/queries/course_information.sql +++ b/tutoraspects/templates/openedx-assets/queries/course_information.sql @@ -4,7 +4,9 @@ select course_run, fes.actor_id as actor_id, fes.enrollment_mode as enrollment_mode, - case when flfc.emission_time >= subtractDays(now(), 7) then actor_id else null end as active_learner, + case + when flfc.emission_time >= subtractDays(now(), 7) then actor_id else null + end as active_learner, tag as course_tag from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_enrollment_status fes left join diff --git a/tutoraspects/templates/openedx-assets/queries/learner_performance_breakdown.sql b/tutoraspects/templates/openedx-assets/queries/learner_performance_breakdown.sql index 82d5a8a28..63c853c7a 100644 --- a/tutoraspects/templates/openedx-assets/queries/learner_performance_breakdown.sql +++ b/tutoraspects/templates/openedx-assets/queries/learner_performance_breakdown.sql @@ -1,13 +1,19 @@ select - org, - actor_id, - course_name, - course_run, - approving_state, - case when fllcv.emission_time >= subtractDays(now(),7) then 'active' - when fllcv.emission_time < subtractDays(now(),7) and approving_state = 'failed' - and enrollment_status = 'registered' then 'at-risk' - else 'other' end as learner_status + org, + actor_id, + course_name, + course_run, + approving_state, + case + when fllcv.emission_time >= subtractDays(now(), 7) + then 'active' + when + fllcv.emission_time < subtractDays(now(), 7) + and approving_state = 'failed' + and enrollment_status = 'registered' + then 'at-risk' + else 'other' + end as learner_status from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_student_status left join {{ ASPECTS_XAPI_DATABASE }}.fact_learner_last_course_visit fllcv using org, course_key, actor_id diff --git a/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql b/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql index 6b90e645d..05bc2a308 100644 --- a/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql +++ b/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql @@ -1,9 +1,12 @@ -with data as ( - 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, - concat(repeat('- ',countMatches(lineage,',')),value) as tag, - row_number() over (order by sort_order_1, sort_order_2, value) as rownum - from {{ ASPECTS_EVENT_SINK_DATABASE }}.most_recent_tags -) select id, rownum, tag from data \ No newline at end of file +with + data as ( + 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, + concat(repeat('- ', countMatches(lineage, ',')), value) as tag, + row_number() over (order by sort_order_1, sort_order_2, value) as rownum + from {{ ASPECTS_EVENT_SINK_DATABASE }}.most_recent_tags + ) +select id, rownum, tag +from data