Skip to content

Commit 0ae2e08

Browse files
committed
fix: bug where juror level was lower than it should
1 parent 97f214a commit 0ae2e08

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

web/src/utils/userLevelCalculation.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,22 @@ const levelCriteria: ILevelCriteria[] = [
1717
export const getUserLevelData = (coherenceScore: number, totalResolvedDisputes: number) => {
1818
for (const criteria of levelCriteria) {
1919
if (
20+
criteria.level > 0 &&
2021
totalResolvedDisputes >= criteria.minDisputes &&
2122
coherenceScore >= criteria.minScore &&
2223
coherenceScore <= criteria.maxScore
2324
) {
24-
return levelCriteria.find(({ level }) => level === criteria.level);
25+
return criteria;
2526
}
2627
}
2728

29+
if (
30+
totalResolvedDisputes >= levelCriteria[0].minDisputes &&
31+
coherenceScore >= levelCriteria[0].minScore &&
32+
coherenceScore <= levelCriteria[0].maxScore
33+
) {
34+
return levelCriteria[0];
35+
}
36+
2837
return levelCriteria.find(({ level }) => level === 1);
2938
};

0 commit comments

Comments
 (0)