diff --git a/src/parser/content-evaluator-module.ts b/src/parser/content-evaluator-module.ts index acca71c5..ff8d232d 100644 --- a/src/parser/content-evaluator-module.ts +++ b/src/parser/content-evaluator-module.ts @@ -84,19 +84,6 @@ export class ContentEvaluatorModule extends BaseModule { return result; } - _getRewardForComment(comment: GithubCommentScore, relevance: number) { - let reward = new Decimal(comment?.score?.reward ?? 0); - - if (comment?.score?.formatting && comment.score.multiplier && comment.score.words) { - let totalRegexReward = new Decimal(0); - totalRegexReward = totalRegexReward.add(comment.score.words.result); - totalRegexReward = totalRegexReward.mul(comment.score.multiplier); - const totalRegexRewardWithRelevance = totalRegexReward.mul(relevance); - reward = reward.sub(totalRegexReward).add(totalRegexRewardWithRelevance); - } - return reward; - } - async _processComment(comments: Readonly[], specificationBody: string, allComments: AllComments) { const commentsWithScore: GithubCommentScore[] = [...comments]; const { commentsToEvaluate, prCommentsToEvaluate } = this._splitCommentsByPrompt(commentsWithScore); @@ -124,15 +111,14 @@ export class ContentEvaluatorModule extends BaseModule { currentRelevance = relevancesByAi[currentComment.id]; } - const currentReward = this._getRewardForComment(currentComment, currentRelevance).mul( - currentComment.score?.priority ?? 1 - ); + // eslint-disable-next-line sonarjs/prefer-nullish-coalescing + const currentReward = new Decimal(currentComment.score?.reward || 0); currentComment.score = { ...(currentComment.score || { multiplier: 0 }), relevance: new Decimal(currentRelevance).toNumber(), priority: currentComment.score?.priority ?? 1, - reward: currentReward.toNumber(), + reward: currentReward.mul(currentRelevance).toNumber(), }; }