From f3316e23923e033b3108e7053099c8d4c65a02f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 22 Jul 2024 18:17:44 +0200 Subject: [PATCH] fix: round average rating to display correct number of stars --- templates/components/rating_stars.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/components/rating_stars.html.twig b/templates/components/rating_stars.html.twig index 896872d..e14a9dc 100644 --- a/templates/components/rating_stars.html.twig +++ b/templates/components/rating_stars.html.twig @@ -1,5 +1,5 @@
{% for grade in range(1, 5) %} - {{ icon('star', html_classes('w-4 h-4', { 'text-gray-200': rating < grade * 100, 'text-primary': rating >= grade * 100 })) }} + {{ icon('star', html_classes('w-4 h-4', { 'text-gray-200': (rating/100)|round < grade, 'text-primary': (rating/100)|round >= grade })) }} {% endfor %}
\ No newline at end of file