This commit is contained in:
Jan Prochazka
2022-12-30 18:54:47 +01:00
parent 242e24b783
commit 637184a28e
3 changed files with 12 additions and 12 deletions

View File

@@ -5,7 +5,7 @@ import _difference from 'lodash/difference';
import debug from 'debug';
import stableStringify from 'json-stable-stringify';
import { PerspectiveDataPattern } from './PerspectiveDataPattern';
import { perspectiveValueMatcherSimple } from './perspectiveTools';
import { perspectiveValueMatcher } from './perspectiveTools';
const dbg = debug('dbgate:PerspectiveCache');
@@ -19,7 +19,7 @@ export class PerspectiveBindingGroup {
matchRow(row) {
return this.table.bindingColumns.every((column, index) =>
perspectiveValueMatcherSimple(row[column], this.bindingValues[index])
perspectiveValueMatcher(row[column], this.bindingValues[index])
);
}
}
@@ -73,7 +73,7 @@ export class PerspectiveCacheTable {
storeGroupSize(props: PerspectiveDataLoadProps, bindingValues: any[], count: number) {
const originalBindingValue = props.bindingValues.find(v =>
_zip(v, bindingValues).every(([x, y]) => perspectiveValueMatcherSimple(x, y))
_zip(v, bindingValues).every(([x, y]) => perspectiveValueMatcher(x, y))
);
// console.log('storeGroupSize NEW', bindingValues);
// console.log('storeGroupSize ORIGINAL', originalBindingValue);

View File

@@ -835,10 +835,10 @@ export class PerspectivePatternColumnNode extends PerspectiveTreeNode {
return null;
}
get generatesHiearchicGridColumn() {
get generatesHiearchicGridColumn(): boolean {
// return true;
// console.log('generatesHiearchicGridColumn', this.parentTableNode?.nodeConfig?.checkedColumns, this.codeName + '::');
if (!!this.tableNodeOrParent?.nodeConfig?.checkedColumns?.find(x => x.startsWith(this.codeName + '::'))) {
if (this.tableNodeOrParent?.nodeConfig?.checkedColumns?.find(x => x.startsWith(this.codeName + '::'))) {
return true;
}
// return false;

View File

@@ -9,14 +9,14 @@ export function getPerspectiveMostNestedChildColumnName(columnName: string) {
return path[path.length - 1];
}
// export function perspectiveValueMatcher(value1, value2): boolean {
// if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid;
// if (Array.isArray(value1)) return !!value1.find(x => perspectiveValueMatcher(x, value2));
// if (Array.isArray(value2)) return !!value2.find(x => perspectiveValueMatcher(value1, x));
// return value1 == value2;
// }
export function perspectiveValueMatcher(value1, value2): boolean {
if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid;
if (Array.isArray(value1)) return !!value1.find(x => perspectiveValueMatcher(x, value2));
if (Array.isArray(value2)) return !!value2.find(x => perspectiveValueMatcher(value1, x));
return value1 == value2;
}
export function perspectiveValueMatcherSimple(value1, value2): boolean {
if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid;
return value1 == value2;
}