fix: wrong comment, no division by zero possible
This commit is contained in:
parent
a55388d290
commit
d4abde7c8f
1 changed files with 2 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue