Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
DROP VIEW IF EXISTS EVALUATION_VIEW;

CREATE VIEW EVALUATION_VIEW AS
SELECT
row_number() OVER () AS row_id,
o.id AS objective_id,
o.team_id,
o.quarter_id,
o.state AS objective_state,
kr.id AS key_result_id,
kr.key_result_type,
kr.baseline,
kr.commit_value,
kr.target_value,
kr.stretch_goal,
ci.value_metric,
CASE
WHEN UPPER(kr.key_result_type) = 'ORDINAL' THEN NULLIF(ci.zone, '')
ELSE NULL
END AS zone,
ci.modified_on AS latest_check_in_date
FROM objective o
LEFT JOIN key_result kr
ON kr.objective_id = o.id
LEFT JOIN LATERAL (
SELECT ci2.*
FROM check_in ci2
WHERE ci2.key_result_id = kr.id
ORDER BY ci2.modified_on DESC
LIMIT 1
) ci ON TRUE
WHERE o.state <> 'DRAFT';
Loading