Skip to content

Commit

Permalink
replace multiple ifs with one switch
Browse files Browse the repository at this point in the history
  • Loading branch information
nevio18324 committed Dec 23, 2024
1 parent d4277c4 commit 1db8e05
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions frontend/cypress/support/helper/scoringSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,18 @@ export function getPercentageMetric(baseline: number, stretchGoal: number, value
}

export function getPercentageOrdinal(zone: string) {
if (zone == 'stretch') {
return 101;
switch (zone) {
case 'fail':
return 30;
case 'commit':
return 70;
case 'target':
return 99.99;
case 'stretch':
return 101;
default:
return 0;
}
if (zone == 'target') {
return 99.99;
}
if (zone == 'commit') {
return 70;
}
if (zone == 'fail') {
return 30;
}
return 0;
}

function validateScoringWidth(zone: string, percent: number, isOverview: boolean) {
Expand Down

0 comments on commit 1db8e05

Please sign in to comment.