Skip to content

Commit dbcb5da

Browse files
committed
adds first comments
1 parent 124ac26 commit dbcb5da

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ export class Summarize implements INodeType {
345345
return [[executionData]];
346346
} else {
347347
if (!fieldsToSplitBy.length) {
348+
// [ria] if no fields to split by
348349
const { pairedItems, ...json } = aggregationResult;
349350
const executionData: INodeExecutionData = {
350351
json,
@@ -354,7 +355,7 @@ export class Summarize implements INodeType {
354355
};
355356
return [[executionData]];
356357
}
357-
const returnData = aggregationToArray(aggregationResult, fieldsToSplitBy);
358+
const returnData = aggregationToArray(aggregationResult, fieldsToSplitBy); // [ria] change here !!
358359
const executionData = returnData.map((item) => {
359360
const { pairedItems, ...json } = item;
360361
return {

packages/nodes-base/nodes/Transform/Summarize/utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export function splitData(
231231
const [firstSplitKey, ...restSplitKeys] = splitKeys;
232232

233233
const groupedData = data.reduce((acc, item) => {
234-
let keyValuee = getValue(item, firstSplitKey) as string;
234+
let keyValuee = getValue(item, firstSplitKey) as string; // [ria] is still a number
235235

236236
if (typeof keyValuee === 'object') {
237237
keyValuee = JSON.stringify(keyValuee);
@@ -240,9 +240,9 @@ export function splitData(
240240
if (options.skipEmptySplitFields && typeof keyValuee !== 'number' && !keyValuee) {
241241
return acc;
242242
}
243-
243+
// [ria] keyValuee is still number at this point
244244
if (acc[keyValuee] === undefined) {
245-
acc[keyValuee] = [item];
245+
acc[keyValuee] = [item]; // [ria] becomes string here
246246
} else {
247247
(acc[keyValuee] as IDataObject[]).push(item);
248248
}

0 commit comments

Comments
 (0)