File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
backend/src/main/resources/db/migration Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ DROP VIEW IF EXISTS EVALUATION_VIEW;
2+
3+ CREATE VIEW EVALUATION_VIEW AS
4+ SELECT
5+ row_number() OVER () AS row_id,
6+ o .id AS objective_id,
7+ o .team_id ,
8+ o .quarter_id ,
9+ o .state AS objective_state,
10+ kr .id AS key_result_id,
11+ kr .key_result_type ,
12+ kr .baseline ,
13+ kr .commit_value ,
14+ kr .target_value ,
15+ kr .stretch_goal ,
16+ ci .value_metric ,
17+ CASE
18+ WHEN UPPER (kr .key_result_type ) = ' ORDINAL' THEN NULLIF(ci .zone , ' ' )
19+ ELSE NULL
20+ END AS zone,
21+ ci .modified_on AS latest_check_in_date
22+ FROM objective o
23+ LEFT JOIN key_result kr
24+ ON kr .objective_id = o .id
25+ LEFT JOIN LATERAL (
26+ SELECT ci2.*
27+ FROM check_in ci2
28+ WHERE ci2 .key_result_id = kr .id
29+ ORDER BY ci2 .modified_on DESC
30+ LIMIT 1
31+ ) ci ON TRUE
32+ WHERE o .state <> ' DRAFT' ;
You can’t perform that action at this time.
0 commit comments