From dbcb5daf606bb2ed01dc3ed24e5b98ad6650d522 Mon Sep 17 00:00:00 2001 From: Ria <123465523+riascho@users.noreply.github.com> Date: Mon, 18 Nov 2024 11:22:13 +0530 Subject: [PATCH] adds first comments --- .../nodes-base/nodes/Transform/Summarize/Summarize.node.ts | 3 ++- packages/nodes-base/nodes/Transform/Summarize/utils.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts b/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts index 12d0e06f22..36a4ce8097 100644 --- a/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts +++ b/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts @@ -345,6 +345,7 @@ export class Summarize implements INodeType { return [[executionData]]; } else { if (!fieldsToSplitBy.length) { + // [ria] if no fields to split by const { pairedItems, ...json } = aggregationResult; const executionData: INodeExecutionData = { json, @@ -354,7 +355,7 @@ export class Summarize implements INodeType { }; return [[executionData]]; } - const returnData = aggregationToArray(aggregationResult, fieldsToSplitBy); + const returnData = aggregationToArray(aggregationResult, fieldsToSplitBy); // [ria] change here !! const executionData = returnData.map((item) => { const { pairedItems, ...json } = item; return { diff --git a/packages/nodes-base/nodes/Transform/Summarize/utils.ts b/packages/nodes-base/nodes/Transform/Summarize/utils.ts index 0094d4d8ef..46dc43a232 100644 --- a/packages/nodes-base/nodes/Transform/Summarize/utils.ts +++ b/packages/nodes-base/nodes/Transform/Summarize/utils.ts @@ -231,7 +231,7 @@ export function splitData( const [firstSplitKey, ...restSplitKeys] = splitKeys; const groupedData = data.reduce((acc, item) => { - let keyValuee = getValue(item, firstSplitKey) as string; + let keyValuee = getValue(item, firstSplitKey) as string; // [ria] is still a number if (typeof keyValuee === 'object') { keyValuee = JSON.stringify(keyValuee); @@ -240,9 +240,9 @@ export function splitData( if (options.skipEmptySplitFields && typeof keyValuee !== 'number' && !keyValuee) { return acc; } - + // [ria] keyValuee is still number at this point if (acc[keyValuee] === undefined) { - acc[keyValuee] = [item]; + acc[keyValuee] = [item]; // [ria] becomes string here } else { (acc[keyValuee] as IDataObject[]).push(item); }