fix: wrong comment, no division by zero possible

This commit is contained in:
Rafael Taranto 2024-05-29 10:37:29 +01:00
parent a55388d290
commit d4abde7c8f

View file

@ -37,9 +37,8 @@ function rate (account, objectType, cryptoCode, objectId) {
const resScore = res.data?.analysis?.assigned?.result?.score
if (!resScore) throw new Error('Failed to get score from Scorechain API')
// normalize score to 0-10 where 0 is the highest risk
// use 101 instead of 100 to avoid division by zero
return { score: (101 - resScore) / 10 - 0.1, isValid: resScore >= threshold }
// normalize score to 0-10 where 0 is the lowest risk
return { score: (100 - resScore) / 10, isValid: resScore >= threshold }
})
.catch(err => {
throw err