Changed : floor function to round
This commit is contained in:
parent
434e090e51
commit
05c83c4322
2 changed files with 8 additions and 11 deletions
|
@ -796,7 +796,6 @@ class CBvideo extends CBCategory
|
||||||
|
|
||||||
$result = $db->select(tbl('video,users'),tbl('video.*,users.userid,users.username'),
|
$result = $db->select(tbl('video,users'),tbl('video.*,users.userid,users.username'),
|
||||||
$cond." AND ".tbl("video.userid")." = ".tbl("users.userid"),$limit,$order);
|
$cond." AND ".tbl("video.userid")." = ".tbl("users.userid"),$limit,$order);
|
||||||
|
|
||||||
if($db->num_rows == 0)
|
if($db->num_rows == 0)
|
||||||
{
|
{
|
||||||
$cond = "";
|
$cond = "";
|
||||||
|
@ -1204,19 +1203,18 @@ class CBvideo extends CBCategory
|
||||||
$type = $params['type'];
|
$type = $params['type'];
|
||||||
|
|
||||||
//Checking Percent
|
//Checking Percent
|
||||||
if($rating<=0)
|
|
||||||
{ $perc = '0'; $disperc = '0'; }
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if($total<=1)
|
if($total<=10)
|
||||||
$total = 1;
|
$total = 10;
|
||||||
$perc = $rating*100/$total;
|
$perc = $rating*100/$total;
|
||||||
$disperc = 100 - $perc;
|
$disperc = 100 - $perc;
|
||||||
|
if($ratings <= 0 && $disperc == 100)
|
||||||
|
$disperc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$perc = $perc.'%';
|
$perc = $perc.'%';
|
||||||
$disperc = $disperc.'%';
|
$disperc = $disperc.'%';
|
||||||
$likes = floor($ratings*$perc/100); // get lowest integer
|
$likes = round($ratings*$perc/100); // get lowest integer
|
||||||
|
|
||||||
if($params['is_rating'])
|
if($params['is_rating'])
|
||||||
{
|
{
|
||||||
|
|
|
@ -2827,7 +2827,6 @@
|
||||||
|
|
||||||
$perc = $perc.'%';
|
$perc = $perc.'%';
|
||||||
$disperc = $disperc."%";
|
$disperc = $disperc."%";
|
||||||
|
|
||||||
switch($style)
|
switch($style)
|
||||||
{
|
{
|
||||||
case "percentage": case "percent":
|
case "percentage": case "percent":
|
||||||
|
@ -2861,7 +2860,7 @@
|
||||||
case "numerical": case "numbers":
|
case "numerical": case "numbers":
|
||||||
case "number": case "num":
|
case "number": case "num":
|
||||||
{
|
{
|
||||||
$likes = floor($ratings*$perc/100);
|
$likes = round($ratings*$perc/100);
|
||||||
$dislikes = $ratings - $likes;
|
$dislikes = $ratings - $likes;
|
||||||
|
|
||||||
$ratingTemplate = '<div class="'.$class.'">
|
$ratingTemplate = '<div class="'.$class.'">
|
||||||
|
|
Loading…
Add table
Reference in a new issue