From a62be38c8565a45b08976edc9ba1d0b353efe15e Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 7 Jul 2021 22:08:19 +0200 Subject: [PATCH] Fixed an issue where fractional rating values were always rounded up. --- es-core/src/components/RatingComponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/es-core/src/components/RatingComponent.cpp b/es-core/src/components/RatingComponent.cpp index a2f1c8aba..6dfc32b3f 100644 --- a/es-core/src/components/RatingComponent.cpp +++ b/es-core/src/components/RatingComponent.cpp @@ -36,8 +36,8 @@ void RatingComponent::setValue(const std::string& value) mValue = 0.0f; } else { - // Round up to the closest .1 value, i.e. to the closest half-icon. - mValue = ceilf(stof(value) / 0.1f) / 10.0f; + // Round to the closest .1 value, i.e. to the closest half-icon. + mValue = std::round(stof(value) / 0.1f) / 10.0f; mOriginalValue = static_cast(mValue * 10.0f); // If the argument to colorize the rating icons has been passed, set the