I'm trying to generate a stars rating system for movies, but somehow, my algorithm doesn't work if the rating >= 2, values like 2.2, 2.8, 3.2 etc... won't output the right star.
<div class="d-flex" style="color: orange;">
{% for i in range(0, 4) %}
{% if movie.rating - i >= 0.8 %}
<i class="bi bi-star-fill"></i>
{% elseif movie.rating - i <= 0.2 %}
<i class="bi bi-star"></i>
{% else %}
<i class="bi bi-star-half"></i>
{% endif %}
{% endfor %}
<span class="ps-1">{{movie.rating}}</span>
</div>