Recently, I have been struggling with implementing half stars in the rating module of my Ionic mobile application. When the average rating is not a whole number, I opted to round it off and display an Ionic icon star. Below are snippets of the code I currently have:
<span *ngIf="item.rating" class="review">
{{item.rating}}
<ion-icon name="star" *ngIf="Round(item.rating) > 0"></ion-icon>
<ion-icon name="star" *ngIf="Round(item.rating) > 1"></ion-icon>
<ion-icon name="star" *ngIf="Round(item.rating) > 2"></ion-icon>
<ion-icon name="star" *ngIf="Round(item.rating) > 3"></ion-icon>
<ion-icon name="star" *ngIf="Round(item.rating) > 4"></ion-icon>
</span>
I am now looking for alternatives to displaying half stars without the need to round off the ratings. Any suggestions or advice on how I can achieve this?