rats-search/lib/rating.js
2017-01-31 11:29:08 +03:00

18 lines
312 B
JavaScript

function biasValuation(count, min, avrg, avrg_const)
{
return ((count / (count + min)) * avrg) + ((min / (min + count)) * avrg_const);
}
function rating(good, bad){
if (good + bad > 0)
{
return biasValuation(good + bad, 9, good / (good + bad), 0.45);
}
else
{
return 0;
}
}
module.exports = rating;