рейтинг

This commit is contained in:
Alexey Kasyanchuk
2017-01-31 10:20:17 +03:00
parent 513b38b730
commit b7cc799cb1
6 changed files with 85 additions and 14 deletions

17
lib/rating.js Normal file
View File

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