Skip to content

Commit

Permalink
Update scoring.component.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
lkleisa authored Dec 4, 2023
1 parent 6de2a88 commit 967264f
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions frontend/src/app/shared/custom/scoring/scoring.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,30 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges {
}

calculatePercentageMetric() {
let KeyResultMetric: KeyResultMetricMin = this.castToMetric();

let percentage = calculateCurrentPercentage(KeyResultMetric);
this.labelPercentage = of(percentage);
switch (true) {
case percentage >= 100:
this.stretched = true;
break;
case percentage > 70:
this.stretched = false;
this.failPercent = 100;
this.commitPercent = 100;
this.targetPercent = (100 / 30) * (percentage - 70);
break;
case percentage > 30:
this.stretched = false;
this.failPercent = 100;
this.commitPercent = (100 / 40) * (percentage - 30);
break;
default:
this.stretched = false;
this.failPercent = (100 / 30) * percentage;
if (this.keyResult.lastCheckIn !== null) {
let keyResultMetric: KeyResultMetricMin = this.castToMetric();

let percentage = calculateCurrentPercentage(keyResultMetric);
this.labelPercentage = of(percentage);
switch (true) {
case percentage >= 100:
this.stretched = true;
break;
case percentage > 70:
this.stretched = false;
this.failPercent = 100;
this.commitPercent = 100;
this.targetPercent = (100 / 30) * (percentage - 70);
break;
case percentage > 30:
this.stretched = false;
this.failPercent = 100;
this.commitPercent = (100 / 40) * (percentage - 30);
break;
default:
this.stretched = false;
this.failPercent = (100 / 30) * percentage;
}
}
}

Expand Down

0 comments on commit 967264f

Please sign in to comment.