рейтинг
This commit is contained in:
17
lib/rating.js
Normal file
17
lib/rating.js
Normal 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;
|
Reference in New Issue
Block a user