diff --git a/frappe/public/js/frappe/form/controls/rating.js b/frappe/public/js/frappe/form/controls/rating.js index 981168457a..2bdfcb7d45 100644 --- a/frappe/public/js/frappe/form/controls/rating.js +++ b/frappe/public/js/frappe/form/controls/rating.js @@ -72,6 +72,7 @@ frappe.ui.form.ControlRating = class ControlRating extends frappe.ui.form.Contro set_formatted_input(value) { let out_of_ratings = this.df.options || 5; value = value * out_of_ratings; + value = Math.round(value * 2) / 2; // roundoff number to nearest 0.5 let el = $(this.input_area).find('svg'); el.children('svg').prevObject.each( function(e) { if (e < value) { diff --git a/frappe/public/js/frappe/form/formatters.js b/frappe/public/js/frappe/form/formatters.js index 5a15b4fd45..22225f5501 100644 --- a/frappe/public/js/frappe/form/formatters.js +++ b/frappe/public/js/frappe/form/formatters.js @@ -88,6 +88,7 @@ frappe.form.formatters = { let rating_html = ''; let number_of_stars = docfield.options || 5; value = value * number_of_stars; + value = Math.round(value * 2) / 2; // roundoff number to nearest 0.5 Array.from({length: cint(number_of_stars)}, (_, i) => i + 1).forEach(i => { rating_html += `