Skip to content

Commit

Permalink
Merge branch 'main' into feature/fct_school_acquisition_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-springer authored Jan 21, 2024
2 parents c804885 + f9d0b03 commit 9d57f8e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dbt/models/marts/teachers/dim_teacher_status.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ with
teacher_section_started as (
select teacher_id,
school_year,
min(section_started_at) as started_teaching_at,
listagg(distinct course_name, ', ') within group (order by course_name ASC) section_courses_started
from {{ ref('int_active_sections') }}
where teacher_id is not null
Expand Down Expand Up @@ -59,7 +60,8 @@ active_status_simple as (
all_sy.teacher_id,
all_sy.school_year,
case when t.teacher_id is null then 0 else 1 end as is_active,
t.section_courses_started
t.section_courses_started,
t.started_teaching_at

from all_teachers_school_years all_sy
left join teacher_section_started t on t.teacher_id = all_sy.teacher_id and t.school_year = all_sy.school_year
Expand All @@ -74,6 +76,7 @@ full_status as (
school_year,
is_active,
section_courses_started,
started_teaching_at,
coalesce(
lag(is_active, 1)
over (partition by teacher_id order by school_year)
Expand Down Expand Up @@ -105,7 +108,8 @@ final as (
when status_code = '110' then '<impossible status>'
when status_code = '111' then 'active retained'
end as status,
section_courses_started
section_courses_started,
started_teaching_at
from
full_status
order by
Expand Down

0 comments on commit 9d57f8e

Please sign in to comment.