2
0
mirror of https://github.com/frappe/books.git synced 2024-11-13 00:46:28 +00:00

refactor: use nullish coalescing

This commit is contained in:
18alantom 2021-10-20 12:28:09 +05:30
parent 6b23aeb986
commit c4b0395b42

View File

@ -435,13 +435,8 @@ module.exports = class BaseDocument extends Observable {
.getMeta(tablefield.childtype) .getMeta(tablefield.childtype)
.getFormulaFields(); .getFormulaFields();
if (formulaFields.length) { if (formulaFields.length) {
let value = this[tablefield.fieldname]; const value = this[tablefield.fieldname]??[];
//if this[table.fieldname] doesnt have value, skip it for (let row of value) {
if (value == null || value == undefined)
continue;
// for each row
for (let row of this[tablefield.fieldname] || []) {
for (let field of formulaFields) { for (let field of formulaFields) {
if (shouldApplyFormula(field, row)) { if (shouldApplyFormula(field, row)) {
let val = await this.getValueFromFormula(field, row); let val = await this.getValueFromFormula(field, row);