Compare commits

...

4 Commits

4 changed files with 20 additions and 7 deletions

View File

@@ -6,6 +6,8 @@
with distinct_cycles as (
select
min(step_submission_date) as cycle_start_date,
max(step_submission_date) as cycle_end_date,
task_name,
case
when count(case when task_status != 'Completed' then 1 end) = 0
@@ -19,9 +21,9 @@ with distinct_cycles as (
select
dense_rank() over (order by task_name)::bigint as id,
null::date as start_date,
null::date as end_date,
cycle_start_date::date as start_date,
cycle_end_date::date as end_date,
task_name as name,
task_status as status,
task_name as type
'Closed' as status, -- overwritten logic for Sarens
'annual' as type
from distinct_cycles

View File

@@ -49,7 +49,7 @@ select
row_number() over (order by user_id, task_name)::bigint as id,
null::date as start,
status,
nullif(regexp_replace(overall_rating, '\D','','g'), '')::numeric as overall_rating_value,
nullif(regexp_replace(overall_rating, '^(\d+).*', '\1'), '')::numeric as overall_rating_value,
overall_rating as overall_rating_text,
cycle_id,
worker_id,

View File

@@ -17,6 +17,16 @@ steps as (
user_id::text as user_id,
task_name,
step_title as name,
case
when step_title in ('Auto-évaluation des employés', 'Employee Self Review', 'Sarens Projects Review',
'Approbation des employés', 'Strategy Review', 'Finance Review',
'Sales Review', 'Fleet Review', 'Self Review', 'LCM Review', 'Operations Review') then 1
when step_title in ('Évaluation du manager', 'Functional Manager Review', 'Discussion et approbation du manager',
'Manager Review') then 2
when step_title in ('HR Review', 'SHEQ Review', 'Performance Conversation & Manager Sign-off') then 3
when step_title = 'Employee Sign-Off' then 4
else null -- fallback for any unexpected values
end as sequence_number,
step_status as status,
step_submission_date::date as completed_at
from {{ source('tap_spreadsheets_anywhere', 'performance_review_steps') }}
@@ -27,6 +37,7 @@ select
row_number() over (order by s.user_id, s.task_name, s.name)::bigint as id,
r.review_id,
s.name,
s.sequence_number,
s.status,
s.completed_at,
null::date as due

View File

@@ -16,7 +16,7 @@ total_scores as (
select
r.review_id,
t.section_name as dimension,
nullif(regexp_replace(t.final_rating, '\D','','g'), '')::numeric as score_value,
nullif(regexp_replace(t.final_rating, '^(\d+).*', '\1'), '')::numeric as score_value,
nullif(trim(t.final_rating), '') as score_text,
null::text as comment
from {{ source('tap_spreadsheets_anywhere', 'performance_review_total_scoring') }} t