Skip to content

Commit 6892570

Browse files
committed
fix: sanitized negative scores
1 parent 32a3fa9 commit 6892570

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/utils/comparator/scoreChecker.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import Badge from "../../components/Badge";
22

33
export const scoreChecker = (currentValue: number, previousValue: number) => {
4+
if(currentValue < 0){
5+
currentValue = 0;
6+
}
7+
8+
if (previousValue < 0){
9+
previousValue = 0;
10+
}
11+
412
const result = currentValue - previousValue;
513

614
if (result > 0) {

0 commit comments

Comments
 (0)