File indexing completed on 2024-04-21 06:00:37

0001 
0002 
0003 DROP FUNCTION IF EXISTS `laplace_score_with_plings`;
0004 
0005 DELIMITER $$
0006 CREATE FUNCTION `laplace_score_with_plings`(`upvotes` INT, `downvotes` INT, `plings` INT) RETURNS int(3)
0007     DETERMINISTIC
0008 BEGIN
0009     DECLARE `score` INT(4);
0010     SET `score` = round((`upvotes` * 8 + `downvotes` * 3 + 2 * 5 + `plings` * 11) /
0011                         (`upvotes` + `downvotes` + 2 + `plings`), 2) * 100;
0012     RETURN `score`;
0013 
0014 END$$
0015 DELIMITER ;