fix: add numbers correctly in report column total (#21661)

[skip ci]
This commit is contained in:
Nautatava Navlakha 2023-07-12 22:02:53 -07:00 committed by GitHub
parent 14798146c7
commit c2d35b773b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -952,11 +952,11 @@ Object.assign(frappe.utils, {
return "";
} else if (values.length > 0) {
if (column.column.fieldtype == "Percent" || type === "mean") {
return values.reduce((a, b) => a + flt(b)) / values.length;
return values.reduce((a, b) => flt(a) + flt(b)) / values.length;
} else if (column.column.fieldtype == "Int") {
return values.reduce((a, b) => a + cint(b));
return values.reduce((a, b) => cint(a) + cint(b));
} else if (frappe.model.is_numeric_field(column.column.fieldtype)) {
return values.reduce((a, b) => a + flt(b));
return values.reduce((a, b) => flt(a) + flt(b));
} else {
return null;
}