[se] Fix bugs in CountIfTypedCache

This commit is contained in:
Sergey Konovalov
2025-12-16 11:42:36 +03:00
parent 46cdc0af91
commit 0980c639fe
2 changed files with 6 additions and 17 deletions

View File

@ -12079,11 +12079,11 @@ function (window, undefined) {
if (!indexes[i]) {
indexes[i] = [];
}
indexes[i] = valueToUnshift.concat(data[i]);
indexes[i] = valueToUnshift.concat(indexes[i]);
}
};
CountIfTypedCache.prototype.updateDataBerofe = function(range, column, startIndex) {
CountIfTypedCache.prototype.updateDataBefore = function(range, column, startIndex) {
column.start = startIndex;
const unshiftDataArrays = {};
const unshiftIndexesArrays = {};
@ -12145,7 +12145,7 @@ function (window, undefined) {
const r1 = startIndex;
const r2 = column.start - 1;
const fullRange = ws.getRange3(r1, columnIndex, r2, columnIndex);
this.updateDataBerofe(fullRange, column, startIndex);
this.updateDataBefore(fullRange, column, startIndex);
}
if (endIndex > column.end) {
const r1 = column.end + 1;
@ -12256,12 +12256,7 @@ function (window, undefined) {
const indexesArray = column.indexes[newType];
const dataArray = column.data[newType];
if (dataArray && indexesArray) {
let insertIndex = 0;
for (let i = 0; i < indexesArray.length; i += 1) {
if (indexesArray[i] < changedIndex) {
insertIndex = i + 1;
}
}
const insertIndex = this.findHigherIndexInTyped(changedIndex - 1, indexesArray);
dataArray.splice(insertIndex, 0, newValue);
indexesArray.splice(insertIndex, 0, changedIndex);
} else {
@ -12286,7 +12281,7 @@ function (window, undefined) {
oldValue = oldValue.toLowerCase();
}
if (oldValue && oldType === cElementType.error) {
oldValue = oldValue.errorType;
oldValue = new cError(oldValue).errorType;
}
}
let newValue = null;
@ -12304,10 +12299,7 @@ function (window, undefined) {
if (oldType === newType && newValue === oldValue) {
return;
}
if (oldType === cElementType.error) {
oldValue
}
this.changeColumnsData(wsId,cell, oldValue, oldType, newValue, newType);
this.changeColumnsData(wsId, cell, oldValue, oldType, newValue, newType);
}
};

View File

@ -19271,13 +19271,11 @@ $(function () {
// Case #40: Area, String. Empty cells check
oParser = new parserFormula('COUNTIF(A200:B205,"<>"&"*")', "C2", ws);
assert.ok(oParser.parse());
debugger;
assert.strictEqual(oParser.calculate().getValue(), 10);
// Case #41: Area, String. Find empty cells check
oParser = new parserFormula('COUNTIF(A200:B205,"")', "C2", ws);
assert.ok(oParser.parse());
debugger;
assert.strictEqual(oParser.calculate().getValue(), 8);
// Case #42: Area, Ref. second arg as cell
@ -19348,7 +19346,6 @@ $(function () {
// Case #49: Area, Formula. Formula test
oParser = new parserFormula('COUNTIF(A311:A314,2+1)', "C2", ws);
assert.ok(oParser.parse());
debugger;
assert.strictEqual(oParser.calculate().getValue(), 1);
const defName3D = new Asc.asc_CDefName('COUNTIFTestName3D', ws.getName() + '!$A$315');