Skip to content

Commit

Permalink
Fix review score logic (#67)
Browse files Browse the repository at this point in the history
Was incorrectly adding 1 to review count, which was reducing the overall review score
  • Loading branch information
ryanmitchell authored Aug 25, 2021
1 parent b9b1844 commit 84e2c7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/Reviews_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,6 @@ public static function getScoreForLocation($locationId)
$totalReviews += $totalRatings;
}

return $totalWeight / ($totalReviews + 1);
return $totalReviews > 0 ? ($totalWeight / $totalReviews) : 0;
}
}

0 comments on commit 84e2c7f

Please sign in to comment.