• Stars are not calced correct in all conditions

    By Christian Brandlehner 2 decades ago

    Sometimes a picture shows more stars than rated. So for example four and a half start for a rating of 3,5.



    This is the broken formula. Maybe someone can find my error or a better solution?



    rating := rating_total/ rating_times;

    roundrating := @Round(rating);

    y := rating - @Integer(rating);

    z := y * 10;

    part := @Round(z);

    int := @Integer(rating);

    @If(rating_total <= 0 | rating_total="";"No ratings yet.";"Ratings so far: "+

    @Text(int) + "." + @Text(part) + " based on "+ @Text(rating_times) + @If(rating_times = 1;" rating ";" ratings ") +

    @Repeat( "\"Star\""; roundrating) +

    @If((
    part > 4) & (_roundrating < 5);"\"*\"";""))