File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -91,17 +91,22 @@ class EvaluationService {
91
91
throw new NotFoundError ( 'Application not found' ) ;
92
92
}
93
93
94
- // Calculate the evaluator score
95
94
let totalScore = 0 ;
96
95
for ( const question of questions ) {
97
- totalScore += question . answerEnum ;
96
+ if ( question . answerEnum === 0 ) {
97
+ // approved
98
+ totalScore += 1 ;
99
+ } else if ( question . answerEnum === 2 ) {
100
+ // uncertain
101
+ totalScore += 0.5 ;
102
+ }
98
103
}
99
104
100
- // Normalize the score to be between 0 and 100
101
- const maxPossibleScore = questions . length * 2 ; // Each question can contribute a maximum of 2 points (uncertain)
102
- const evaluatorScore = Math . round (
103
- ( 1 - totalScore / maxPossibleScore ) * 100
104
- ) ;
105
+ // Calculate the maximum possible score
106
+ const maxPossibleScore = questions . length ;
107
+
108
+ // Calculate the evaluator score as a percentage
109
+ const evaluatorScore = Math . round ( ( totalScore / maxPossibleScore ) * 100 ) ;
105
110
106
111
// Set the evaluation status if the evaluator is not human
107
112
if ( evaluatorType !== EVALUATOR_TYPE . HUMAN ) {
You can’t perform that action at this time.
0 commit comments