diff --git a/code/SeoObjectExtension.php b/code/SeoObjectExtension.php index bfcc737..49d4638 100644 --- a/code/SeoObjectExtension.php +++ b/code/SeoObjectExtension.php @@ -164,14 +164,18 @@ public function updateCMSFields(FieldList $fields) { /** * getHTMLStars. - * Get html of stars rating in CMS + * Get html of stars rating in CMS, maximum score is 12 + * threshold 2 * * @param none * @return String $html */ public function getHTMLStars() { - $num_stars = intval(ceil($this->seo_score) / 2); + $treshold_score = $this->seo_score - 2 < 0 ? 0 : $this->seo_score - 2; + + $num_stars = intval(ceil($treshold_score) / 2); + $num_nostars = 5 - $num_stars; $html = '