adds first comments

This commit is contained in:
Ria 2024-11-18 11:22:13 +05:30
parent 124ac26e43
commit dbcb5daf60
2 changed files with 5 additions and 4 deletions

View file

@ -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 {

View file

@ -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);
}