Commit 58ab01bc authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 33687 🐛

parent dd4a173c
...@@ -2652,23 +2652,24 @@ cPOWER.prototype.getInfo = function () { ...@@ -2652,23 +2652,24 @@ cPOWER.prototype.getInfo = function () {
cPRODUCT.prototype = Object.create(cBaseFunction.prototype); cPRODUCT.prototype = Object.create(cBaseFunction.prototype);
cPRODUCT.prototype.Calculate = function (arg) { cPRODUCT.prototype.Calculate = function (arg) {
var arg0 = new cNumber(1); var element, arg0 = new cNumber(1);
for (var i = 0; i < arg.length; i++) { for (var i = 0; i < arg.length; i++) {
if (cElementType.cellsRange === arg[i].type || cElementType.cellsRange3D === arg[i].type) { element = arg[i];
var _arrVal = arg[i].getValue(this.checkExclude, this.excludeHiddenRows); if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var _arrVal = element.getValue(this.checkExclude, this.excludeHiddenRows);
for (var j = 0; j < _arrVal.length; j++) { for (var j = 0; j < _arrVal.length; j++) {
arg0 = _func[arg0.type][_arrVal[j].type](arg0, _arrVal[j], "*"); arg0 = _func[arg0.type][_arrVal[j].type](arg0, _arrVal[j], "*");
if (cElementType.error === arg0.type) { if (cElementType.error === arg0.type) {
return this.value = arg0; return this.value = arg0;
} }
} }
} else if (cElementType.cell === arg[i].type || cElementType.cell3D === arg[i].type) { } else if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
var _arg = arg[i].getValue(); var _arg = element.getValue();
arg0 = _func[arg0.type][_arg.type](arg0, _arg, "*"); arg0 = _func[arg0.type][_arg.type](arg0, _arg, "*");
} }
} else if (cElementType.array === arg[i].type) { } else if (cElementType.array === element.type) {
arg[i].foreach(function (elem) { element.foreach(function (elem) {
if (cElementType.string === elem.type || cElementType.bool === elem.type || cElementType.empty === elem.type) { if (cElementType.string === elem.type || cElementType.bool === elem.type || cElementType.empty === elem.type) {
return; return;
} }
...@@ -2676,7 +2677,7 @@ cPOWER.prototype.getInfo = function () { ...@@ -2676,7 +2677,7 @@ cPOWER.prototype.getInfo = function () {
arg0 = _func[arg0.type][elem.type](arg0, elem, "*"); arg0 = _func[arg0.type][elem.type](arg0, elem, "*");
}) })
} else { } else {
arg0 = _func[arg0.type][arg[i].type](arg0, arg[i], "*"); arg0 = _func[arg0.type][element.type](arg0, element, "*");
} }
if (cElementType.error === arg0.type) { if (cElementType.error === arg0.type) {
return this.value = arg0; return this.value = arg0;
......
...@@ -1077,30 +1077,30 @@ cCORREL.prototype.getInfo = function () { ...@@ -1077,30 +1077,30 @@ cCORREL.prototype.getInfo = function () {
cCOUNTA.prototype = Object.create(cBaseFunction.prototype); cCOUNTA.prototype = Object.create(cBaseFunction.prototype);
cCOUNTA.prototype.Calculate = function (arg) { cCOUNTA.prototype.Calculate = function (arg) {
var count = 0; var element, count = 0;
for (var i = 0; i < arg.length; i++) { for (var i = 0; i < arg.length; i++) {
var _arg = arg[i]; element = arg[i];
if (cElementType.cell === _arg.type || cElementType.cell3D === _arg.type) { if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
var _argV = _arg.getValue(); var _argV = element.getValue();
if (cElementType.empty !== _argV.type) { if (cElementType.empty !== _argV.type) {
count++; count++;
} }
} }
} else if (cElementType.cellsRange === _arg.type || cElementType.cellsRange3D === _arg.type) { } else if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var _argAreaValue = _arg.getValue(this.checkExclude, this.excludeHiddenRows); var _argAreaValue = element.getValue(this.checkExclude, this.excludeHiddenRows);
for (var j = 0; j < _argAreaValue.length; j++) { for (var j = 0; j < _argAreaValue.length; j++) {
if (cElementType.empty !== _argAreaValue[j].type) { if (cElementType.empty !== _argAreaValue[j].type) {
count++; count++;
} }
} }
} else if (cElementType.array === _arg.type) { } else if (cElementType.array === element.type) {
_arg.foreach(function (elem) { element.foreach(function (elem) {
if (cElementType.empty !== elem.type) { if (cElementType.empty !== elem.type) {
count++; count++;
} }
}) })
} else if (cElementType.empty !== _arg.type) { } else if (cElementType.empty !== element.type) {
count++; count++;
} }
} }
...@@ -2665,11 +2665,11 @@ cLOGNORMDIST.prototype.getInfo = function () { ...@@ -2665,11 +2665,11 @@ cLOGNORMDIST.prototype.getInfo = function () {
cMAX.prototype = Object.create(cBaseFunction.prototype); cMAX.prototype = Object.create(cBaseFunction.prototype);
cMAX.prototype.Calculate = function (arg) { cMAX.prototype.Calculate = function (arg) {
var v, argI, argIVal, max = Number.NEGATIVE_INFINITY; var v, element, argIVal, max = Number.NEGATIVE_INFINITY;
for (var i = 0; i < this.argumentsCurrent; i++) { for (var i = 0; i < this.argumentsCurrent; i++) {
argI = arg[i]; element = arg[i];
argIVal = argI.getValue(); argIVal = element.getValue();
if (cElementType.cell === argI.type || cElementType.cell3D === argI.type) { if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
if (cElementType.error === argIVal.type) { if (cElementType.error === argIVal.type) {
return this.value = argIVal; return this.value = argIVal;
...@@ -2681,8 +2681,8 @@ cLOGNORMDIST.prototype.getInfo = function () { ...@@ -2681,8 +2681,8 @@ cLOGNORMDIST.prototype.getInfo = function () {
} }
} }
} }
} else if (cElementType.cellsRange === argI.type || cElementType.cellsRange3D === argI.type) { } else if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var argArr = argI.getValue(this.checkExclude, this.excludeHiddenRows); var argArr = element.getValue(this.checkExclude, this.excludeHiddenRows);
for (var j = 0; j < argArr.length; j++) { for (var j = 0; j < argArr.length; j++) {
if (cElementType.number === argArr[j].type) { if (cElementType.number === argArr[j].type) {
v = argArr[j].tocNumber(); v = argArr[j].tocNumber();
...@@ -2693,22 +2693,22 @@ cLOGNORMDIST.prototype.getInfo = function () { ...@@ -2693,22 +2693,22 @@ cLOGNORMDIST.prototype.getInfo = function () {
return this.value = argArr[j]; return this.value = argArr[j];
} }
} }
} else if (cElementType.error === argI.type) { } else if (cElementType.error === element.type) {
return this.value = argI; return this.value = element;
} else if (cElementType.string === argI.type) { } else if (cElementType.string === element.type) {
v = argI.tocNumber(); v = element.tocNumber();
if (cElementType.number === v.type) { if (cElementType.number === v.type) {
if (v.getValue() > max) { if (v.getValue() > max) {
max = v.getValue(); max = v.getValue();
} }
} }
} else if (cElementType.bool === argI.type || cElementType.empty === argI.type) { } else if (cElementType.bool === element.type || cElementType.empty === element.type) {
v = argI.tocNumber(); v = element.tocNumber();
if (v.getValue() > max) { if (v.getValue() > max) {
max = v.getValue(); max = v.getValue();
} }
} else if (cElementType.array === argI.type) { } else if (cElementType.array === element.type) {
argI.foreach(function (elem) { element.foreach(function (elem) {
if (cElementType.number === elem.type) { if (cElementType.number === elem.type) {
if (elem.getValue() > max) { if (elem.getValue() > max) {
max = elem.getValue(); max = elem.getValue();
...@@ -2722,8 +2722,8 @@ cLOGNORMDIST.prototype.getInfo = function () { ...@@ -2722,8 +2722,8 @@ cLOGNORMDIST.prototype.getInfo = function () {
return this.value = max; return this.value = max;
} }
} else { } else {
if (argI.getValue() > max) { if (element.getValue() > max) {
max = argI.getValue(); max = element.getValue();
} }
} }
} }
...@@ -2929,11 +2929,11 @@ cMEDIAN.prototype.getInfo = function () { ...@@ -2929,11 +2929,11 @@ cMEDIAN.prototype.getInfo = function () {
cMIN.prototype = Object.create(cBaseFunction.prototype); cMIN.prototype = Object.create(cBaseFunction.prototype);
cMIN.prototype.Calculate = function (arg) { cMIN.prototype.Calculate = function (arg) {
var v, argI, argIVal, min = Number.POSITIVE_INFINITY; var v, element, argIVal, min = Number.POSITIVE_INFINITY;
for (var i = 0; i < this.argumentsCurrent; i++) { for (var i = 0; i < this.argumentsCurrent; i++) {
argI = arg[i]; element = arg[i];
argIVal = argI.getValue(); argIVal = element.getValue();
if (cElementType.cell === argI.type || cElementType.cell3D === argI.type) { if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
if (cElementType.error === argIVal.type) { if (cElementType.error === argIVal.type) {
return this.value = argIVal; return this.value = argIVal;
...@@ -2945,8 +2945,8 @@ cMEDIAN.prototype.getInfo = function () { ...@@ -2945,8 +2945,8 @@ cMEDIAN.prototype.getInfo = function () {
} }
} }
} }
} else if (cElementType.cellsRange === argI.type || cElementType.cellsRange3D === argI.type) { } else if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var argArr = argI.getValue(this.checkExclude, this.excludeHiddenRows); var argArr = element.getValue(this.checkExclude, this.excludeHiddenRows);
for (var j = 0; j < argArr.length; j++) { for (var j = 0; j < argArr.length; j++) {
if (cElementType.number === argArr[j].type) { if (cElementType.number === argArr[j].type) {
v = argArr[j].tocNumber(); v = argArr[j].tocNumber();
...@@ -2958,22 +2958,22 @@ cMEDIAN.prototype.getInfo = function () { ...@@ -2958,22 +2958,22 @@ cMEDIAN.prototype.getInfo = function () {
return this.value = argArr[j]; return this.value = argArr[j];
} }
} }
} else if (cElementType.error === argI.type) { } else if (cElementType.error === element.type) {
return this.value = argI; return this.value = element;
} else if (cElementType.string === argI.type) { } else if (cElementType.string === element.type) {
v = argI.tocNumber(); v = element.tocNumber();
if (cElementType.number === v.type) { if (cElementType.number === v.type) {
if (v.getValue() < min) { if (v.getValue() < min) {
min = v.getValue(); min = v.getValue();
} }
} }
} else if (cElementType.bool === argI.type || cElementType.empty === argI.type) { } else if (cElementType.bool === element.type || cElementType.empty === element.type) {
v = argI.tocNumber(); v = element.tocNumber();
if (v.getValue() < min) { if (v.getValue() < min) {
min = v.getValue(); min = v.getValue();
} }
} else if (cElementType.array === argI.type) { } else if (cElementType.array === element.type) {
argI.foreach(function (elem) { element.foreach(function (elem) {
if (cElementType.number === elem.type) { if (cElementType.number === elem.type) {
if (elem.getValue() < min) { if (elem.getValue() < min) {
min = elem.getValue(); min = elem.getValue();
...@@ -2987,8 +2987,8 @@ cMEDIAN.prototype.getInfo = function () { ...@@ -2987,8 +2987,8 @@ cMEDIAN.prototype.getInfo = function () {
return this.value = min; return this.value = min;
} }
} else { } else {
if (argI.getValue() < min) { if (element.getValue() < min) {
min = argI.getValue(); min = element.getValue();
} }
} }
} }
...@@ -4726,20 +4726,20 @@ cSTANDARDIZE.prototype.getInfo = function () { ...@@ -4726,20 +4726,20 @@ cSTANDARDIZE.prototype.getInfo = function () {
cSTDEV.prototype = Object.create(cBaseFunction.prototype); cSTDEV.prototype = Object.create(cBaseFunction.prototype);
cSTDEV.prototype.Calculate = function (arg) { cSTDEV.prototype.Calculate = function (arg) {
var i, count = 0, sum = new cNumber(0), member = []; var i, element, count = 0, sum = new cNumber(0), member = [];
for (i = 0; i < arg.length; i++) { for (i = 0; i < arg.length; i++) {
var _arg = arg[i]; element = arg[i];
if (cElementType.cell === _arg.type || cElementType.cell3D === _arg.type) { if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
var _argV = _arg.getValue(); var _argV = element.getValue();
if (cElementType.number === _argV.type) { if (cElementType.number === _argV.type) {
member.push(_argV); member.push(_argV);
sum = _func[sum.type][_argV.type](sum, _argV, "+"); sum = _func[sum.type][_argV.type](sum, _argV, "+");
count++; count++;
} }
} }
} else if (cElementType.cellsRange === _arg.type || cElementType.cellsRange3D === _arg.type) { } else if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var _argAreaValue = _arg.getValue(this.checkExclude, this.excludeHiddenRows); var _argAreaValue = element.getValue(this.checkExclude, this.excludeHiddenRows);
for (var j = 0; j < _argAreaValue.length; j++) { for (var j = 0; j < _argAreaValue.length; j++) {
var __arg = _argAreaValue[j]; var __arg = _argAreaValue[j];
if (cElementType.number === __arg.type) { if (cElementType.number === __arg.type) {
...@@ -4748,8 +4748,8 @@ cSTANDARDIZE.prototype.getInfo = function () { ...@@ -4748,8 +4748,8 @@ cSTANDARDIZE.prototype.getInfo = function () {
count++; count++;
} }
} }
} else if (cElementType.array === _arg.type) { } else if (cElementType.array === element.type) {
_arg.foreach(function (elem) { element.foreach(function (elem) {
var e = elem.tocNumber(); var e = elem.tocNumber();
if (cElementType.number === e.type) { if (cElementType.number === e.type) {
member.push(e); member.push(e);
...@@ -4758,10 +4758,10 @@ cSTANDARDIZE.prototype.getInfo = function () { ...@@ -4758,10 +4758,10 @@ cSTANDARDIZE.prototype.getInfo = function () {
} }
}) })
} else { } else {
_arg = _arg.tocNumber(); element = element.tocNumber();
if (cElementType.number === _arg.type) { if (cElementType.number === element.type) {
member.push(_arg); member.push(element);
sum = _func[sum.type][_arg.type](sum, _arg, "+"); sum = _func[sum.type][element.type](sum, element, "+");
count++; count++;
} }
} }
...@@ -4896,33 +4896,33 @@ cSTDEVA.prototype.getInfo = function () { ...@@ -4896,33 +4896,33 @@ cSTDEVA.prototype.getInfo = function () {
return new cNumber(isNaN(_x) ? new cError(cErrorType.division_by_zero) : Math.sqrt(sumSQRDeltaX / xLength)); return new cNumber(isNaN(_x) ? new cError(cErrorType.division_by_zero) : Math.sqrt(sumSQRDeltaX / xLength));
} }
var arr0 = []; var element, arr0 = [];
for (var j = 0; j < arg.length; j++) { for (var j = 0; j < arg.length; j++) {
var _arg = arg[j]; element = arg[j];
if (cElementType.cellsRange === _arg.type || cElementType.cellsRange3D === _arg.type) { if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var _arrVal = arg.getValue(this.checkExclude, this.excludeHiddenRows); var _arrVal = arg.getValue(this.checkExclude, this.excludeHiddenRows);
_arrVal.forEach(function (elem) { _arrVal.forEach(function (elem) {
if (cElementType.number === elem.type || cElementType.error === elem.type) { if (cElementType.number === elem.type || cElementType.error === elem.type) {
arr0.push(elem); arr0.push(elem);
} }
}); });
} else if (cElementType.cell === _arg.type || cElementType.cell3D === _arg.type) { } else if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
var a = _arg.getValue(); var a = element.getValue();
if (cElementType.number === a.type || cElementType.error === a.type) { if (cElementType.number === a.type || cElementType.error === a.type) {
arr0.push(a); arr0.push(a);
} }
} }
} else if (cElementType.array === _arg.type) { } else if (cElementType.array === element.type) {
_arg.foreach(function (elem) { element.foreach(function (elem) {
if (cElementType.number === elem.type || cElementType.error === elem.type) { if (cElementType.number === elem.type || cElementType.error === elem.type) {
arr0.push(elem); arr0.push(elem);
} }
}); });
} else if (cElementType.number === _arg.type || cElementType.bool === _arg.type) { } else if (cElementType.number === element.type || cElementType.bool === element.type) {
arr0.push(_arg.tocNumber()); arr0.push(element.tocNumber());
} else if (cElementType.string === _arg.type || cElementType.empty === _arg.type) { } else if (cElementType.string === element.type || cElementType.empty === element.type) {
arr0.push(new cNumber(0)); arr0.push(new cNumber(0));
} else { } else {
return this.value = new cError(cErrorType.wrong_value_type); return this.value = new cError(cErrorType.wrong_value_type);
...@@ -5216,33 +5216,33 @@ cTTEST.prototype = Object.create( cBaseFunction.prototype ); ...@@ -5216,33 +5216,33 @@ cTTEST.prototype = Object.create( cBaseFunction.prototype );
} }
var arr0 = []; var element, arr0 = [];
for (var j = 0; j < arg.length; j++) { for (var j = 0; j < arg.length; j++) {
var _arg = arg[j]; element = arg[j];
if (cElementType.cellsRange === _arg.type || cElementType.cellsRange3D === _arg.type) { if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var _arrVal = _arg.getValue(this.checkExclude, this.excludeHiddenRows); var _arrVal = element.getValue(this.checkExclude, this.excludeHiddenRows);
_arrVal.forEach(function (elem) { _arrVal.forEach(function (elem) {
if (cElementType.number === elem.type || cElementType.error === elem.type) { if (cElementType.number === elem.type || cElementType.error === elem.type) {
arr0.push(elem); arr0.push(elem);
} }
}); });
} else if (cElementType.cell === _arg.type || cElementType.cell3D === _arg.type) { } else if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
var a = _arg.getValue(); var a = element.getValue();
if (cElementType.number === a.type || cElementType.error === a.type) { if (cElementType.number === a.type || cElementType.error === a.type) {
arr0.push(a); arr0.push(a);
} }
} }
} else if (cElementType.array === _arg.type) { } else if (cElementType.array === element.type) {
_arg.foreach(function (elem) { element.foreach(function (elem) {
if (cElementType.number === elem.type || cElementType.error === elem.type) { if (cElementType.number === elem.type || cElementType.error === elem.type) {
arr0.push(elem); arr0.push(elem);
} }
}); });
} else if (cElementType.number === _arg.type || cElementType.bool === _arg.type) { } else if (cElementType.number === element.type || cElementType.bool === element.type) {
arr0.push(_arg.tocNumber()); arr0.push(element.tocNumber());
} else if (cElementType.string === _arg.type || cElementType.empty === _arg.type) { } else if (cElementType.string === element.type || cElementType.empty === element.type) {
continue; continue;
} else { } else {
return this.value = new cError(cErrorType.wrong_value_type); return this.value = new cError(cErrorType.wrong_value_type);
...@@ -5418,33 +5418,33 @@ cVARA.prototype.getInfo = function () { ...@@ -5418,33 +5418,33 @@ cVARA.prototype.getInfo = function () {
} }
var arr0 = []; var element, arr0 = [];
for (var j = 0; j < arg.length; j++) { for (var j = 0; j < arg.length; j++) {
var _arg = arg[j]; element = arg[j];
if (cElementType.cellsRange === _arg.type || cElementType.cellsRange3D === _arg.type) { if (cElementType.cellsRange === element.type || cElementType.cellsRange3D === element.type) {
var _arrVal = _arg.getValue(this.checkExclude, this.excludeHiddenRows); var _arrVal = element.getValue(this.checkExclude, this.excludeHiddenRows);
_arrVal.forEach(function (elem) { _arrVal.forEach(function (elem) {
if (cElementType.number === elem.type || cElementType.error === elem.type) { if (cElementType.number === elem.type || cElementType.error === elem.type) {
arr0.push(elem); arr0.push(elem);
} }
}); });
} else if (cElementType.cell === _arg.type || cElementType.cell3D === _arg.type) { } else if (cElementType.cell === element.type || cElementType.cell3D === element.type) {
if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) { if (!this.checkExclude || !element.isHidden(this.excludeHiddenRows)) {
var a = _arg.getValue(); var a = element.getValue();
if (cElementType.number === a.type || cElementType.error === a.type) { if (cElementType.number === a.type || cElementType.error === a.type) {
arr0.push(a); arr0.push(a);
} }
} }
} else if (cElementType.array === _arg.type) { } else if (cElementType.array === element.type) {
_arg.foreach(function (elem) { element.foreach(function (elem) {
if (cElementType.number === elem.type || cElementType.error === elem.type) { if (cElementType.number === elem.type || cElementType.error === elem.type) {
arr0.push(elem); arr0.push(elem);
} }
}); });
} else if (cElementType.number === _arg.type || cElementType.bool === _arg.type) { } else if (cElementType.number === element.type || cElementType.bool === element.type) {
arr0.push(_arg.tocNumber()); arr0.push(element.tocNumber());
} else if (cElementType.string === _arg.type || cElementType.empty === _arg.type) { } else if (cElementType.string === element.type || cElementType.empty === element.type) {
arr0.push(new cNumber(0)); arr0.push(new cNumber(0));
} else { } else {
return this.value = new cError(cErrorType.wrong_value_type); return this.value = new cError(cErrorType.wrong_value_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment