Skip to content

Commit 9b384a9

Browse files
Bug/1679 cant edit keyresults of a duped objective (#1684)
* fix: duped keyresults not editable #1679 * fix: add a migration to fix keyresults without commit and/or target values #1679 * fix: update table selection #1679 --------- Co-authored-by: schiltpzzle <[email protected]>
1 parent 66cc057 commit 9b384a9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

backend/src/main/java/ch/puzzle/okr/service/business/KeyResultBusinessService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ private KeyResult makeCopyOfKeyResultMetric(KeyResult keyResult, Objective dupli
169169
.withUnit(((KeyResultMetric) keyResult).getUnit()) //
170170
.withBaseline(((KeyResultMetric) keyResult).getBaseline()) //
171171
.withStretchGoal(((KeyResultMetric) keyResult).getStretchGoal()) //
172+
.withCommitValue(((KeyResultMetric) keyResult).getCommitValue()) //
173+
.withTargetValue(((KeyResultMetric) keyResult).getTargetValue()) //
172174
.build();
173175
}
174176

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
UPDATE key_result
2+
SET
3+
target_value = ROUND((baseline + (stretch_goal - baseline) * 0.7)::numeric, 2),
4+
commit_value = ROUND((baseline + (stretch_goal - baseline) * 0.3)::numeric, 2)
5+
WHERE baseline IS NOT NULL
6+
AND stretch_goal IS NOT NULL
7+
AND target_value is NULL
8+
AND commit_value is NULL;

0 commit comments

Comments
 (0)