Skip to content

Commit

Permalink
fix updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3orblade committed Nov 15, 2024
1 parent 800eaa2 commit 1a0e653
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
22 changes: 11 additions & 11 deletions src/ts/component/block/dataview/view/grid/foot/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const FootCell = observer(class FootCell extends React.Component<Props, State> {
};

componentDidUpdate (): void {
this.calculate();
};

setEditing (isEditing: boolean): void {
Expand All @@ -80,7 +81,12 @@ const FootCell = observer(class FootCell extends React.Component<Props, State> {
const viewRelation = view.getRelation(relationKey);
const result = Dataview.getFormulaResult(rootId, block.id, relationKey, viewRelation);

this.setState({ result });
console.log('[Calculate]', relationKey, result);

if (this.state.result !== result) {
this.state.result = result;
this.setState({ result });
};
};

onChange (id: string): void {
Expand All @@ -89,19 +95,13 @@ const FootCell = observer(class FootCell extends React.Component<Props, State> {
const relations = view.getRelations();
const idx = relations.findIndex(it => it.relationKey == relationKey);

console.log(view);

/*
const item = view.getRelation(relationKey);
item.formulaType = Number(id) || I.FormulaType.None;
console.log(JSON.stringify(view, null, 3));
view.relations[idx].formulaType = Number(id) || I.FormulaType.None;

S.Record.viewUpdate(rootId, view.id, view);
this.setEditing(false);

/*
//C.BlockDataviewViewRelationReplace(rootId, block.id, view.id, item.relationKey, { ...item, formulaType: item.formulaType });
this.setState({ isEditing: false });
*/
};

Expand Down
4 changes: 0 additions & 4 deletions src/ts/lib/dataview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,6 @@ class Dataview {
};

getFormulaResult (rootId: string, blockId: string, relationKey: string, viewRelation: I.ViewRelation): any {
console.log(viewRelation);

const { formulaType, includeTime, timeFormat, dateFormat } = viewRelation;
const relation = S.Record.getRelationByKey(relationKey);
const subId = S.Record.getSubId(rootId, blockId);
Expand Down Expand Up @@ -653,8 +651,6 @@ class Dataview {
};
};

console.log('[Dataview.getFormulaResult]', ret);

return ret;
};

Expand Down

0 comments on commit 1a0e653

Please sign in to comment.