Pārlūkot izejas kodu

fix: Rating field value is faulty in list view (#17672)

version-14
Shariq Ansari pirms 2 gadiem
committed by GitHub
vecāks
revīzija
1b9aef4034
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
2 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. +1
    -0
      frappe/public/js/frappe/form/controls/rating.js
  2. +1
    -0
      frappe/public/js/frappe/form/formatters.js

+ 1
- 0
frappe/public/js/frappe/form/controls/rating.js Parādīt failu

@@ -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) {


+ 1
- 0
frappe/public/js/frappe/form/formatters.js Parādīt failu

@@ -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 += `<svg class="icon icon-md" data-rating=${i} viewBox="0 0 24 24" fill="none">
<path class="right-half ${i <= (value || 0) ? "star-click": "" }" d="M11.9987 3.00011C12.177 3.00011 12.3554 3.09303 12.4471 3.27888L14.8213 8.09112C14.8941 8.23872 15.0349 8.34102 15.1978 8.3647L20.5069 9.13641C20.917 9.19602 21.0807 9.69992 20.7841 9.9892L16.9421 13.7354C16.8243 13.8503 16.7706 14.0157 16.7984 14.1779L17.7053 19.4674C17.7753 19.8759 17.3466 20.1874 16.9798 19.9945L12.2314 17.4973C12.1586 17.459 12.0786 17.4398 11.9987 17.4398V3.00011Z" fill="var(--star-fill)" stroke="var(--star-fill)"/>


Notiek ielāde…
Atcelt
Saglabāt