Skip to content

Commit d7b0714

Browse files
committed
fix: only update scores negatively when diff < -10
1 parent 9051c26 commit d7b0714

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/handlers/points.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ export const handleFixedPointScore = async function(prisma: PrismaClient, type:
145145
// Score(s) were already given for this type and typeIntraId in the past.
146146
// Calculate the point difference and hand out the difference as a new score.
147147
const pointDifference = Math.floor(Math.floor(points) - existingScores._sum.amount);
148-
if (pointDifference == 0) {
149-
console.log(`Score(s) already exist for type ${type.type} and typeIntraId ${typeIntraId}. Point difference is 0, no need to create a new score.`);
148+
if (pointDifference < -10 ) {
149+
console.log(`Score(s) already exist for type ${type.type} and typeIntraId ${typeIntraId}. Point difference is (close to) 0, no need to create a new score.`);
150150
return null; // No difference in points, no need to create a new score
151151
}
152152
console.log(`Score(s) already exist for type ${type.type} and typeIntraId ${typeIntraId}. Point difference is ${pointDifference}, handing out the difference as a new score...`);

0 commit comments

Comments
 (0)