Skip to content

Commit

Permalink
fix(cf): duplicate and unique not work with p (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gggpound committed Mar 25, 2024
1 parent 7c002cc commit 551f2a1
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export const highlightCellCalculateUnit: ICalculateUnit = {
rule.ranges.forEach((range) => {
Range.foreach(range, (row, col) => {
const cell = worksheet?.getCellRaw(row, col);
if (cell && cell.t === CellValueType.NUMBER) {
sum += Number(cell.v || 0);
const v = getCellValue(cell || undefined);
if (cell && cell.t === CellValueType.NUMBER && v !== undefined) {
sum += Number(v) || 0;
count++;
}
});
Expand All @@ -53,12 +54,13 @@ export const highlightCellCalculateUnit: ICalculateUnit = {
rule.ranges.forEach((range) => {
Range.foreach(range, (row, col) => {
const cell = worksheet?.getCellRaw(row, col);
if (cell && !isNullable(cell.v)) {
const cache = cacheMap.get(cell.v);
const v = getCellValue(cell || undefined);
if (v !== undefined) {
const cache = cacheMap.get(v);
if (cache) {
cacheMap.set(cell.v, cache + 1);
cacheMap.set(v, cache + 1);
} else {
cacheMap.set(cell.v, 1);
cacheMap.set(v, 1);
}
}
});
Expand All @@ -70,8 +72,9 @@ export const highlightCellCalculateUnit: ICalculateUnit = {
rule.ranges.forEach((range) => {
Range.foreach(range, (row, col) => {
const cell = worksheet?.getCellRaw(row, col);
if (cell && cell.t === CellValueType.NUMBER) {
allValue.push(Number(cell.v || 0));
const v = getCellValue(cell || undefined);
if (cell && cell.t === CellValueType.NUMBER && v !== undefined) {
allValue.push(Number(v) || 0);
}
});
});
Expand Down

0 comments on commit 551f2a1

Please sign in to comment.