Skip to content

Commit 91cedcb

Browse files
committed
fix(frontend): Fix updating of commitValue when creating new key-results #1570
1 parent c6fe2db commit 91cedcb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

frontend/src/app/components/key-result-type/key-result-type.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,18 @@ export class KeyResultTypeComponent implements AfterContentInit {
117117

118118
switch (field) {
119119
case KeyResultMetricField.BASELINE: {
120-
return { baseline: roundToTwoDecimals((values.targetValue - values.stretchGoal * 0.7) / 0.3) };
120+
return { baseline: roundToTwoDecimals((values.targetValue - values.stretchGoal * 0.7) / 0.3),
121+
commitValue: roundToTwoDecimals((values.stretchGoal - values.baseline) * 0.3 + values.baseline) };
121122
}
122123

123124
case KeyResultMetricField.TARGET_VALUE: {
124-
return { targetValue: roundToTwoDecimals((values.stretchGoal - values.baseline) * 0.7 + values.baseline) };
125+
return { targetValue: roundToTwoDecimals((values.stretchGoal - values.baseline) * 0.7 + values.baseline),
126+
commitValue: roundToTwoDecimals((values.stretchGoal - values.baseline) * 0.3 + values.baseline) };
125127
}
126128

127129
case KeyResultMetricField.STRETCH_GOAL: {
128-
return { stretchGoal: roundToTwoDecimals((values.targetValue - values.baseline) / 0.7 + values.baseline) };
130+
return { stretchGoal: roundToTwoDecimals((values.targetValue - values.baseline) / 0.7 + values.baseline),
131+
commitValue: roundToTwoDecimals((values.stretchGoal - values.baseline) * 0.3 + values.baseline) };
129132
}
130133

131134
case KeyResultMetricField.NONE: {

0 commit comments

Comments
 (0)