mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
🐛 Do not error if there is no data on Google Analytics + Sort
This commit is contained in:
parent
fe71c665fe
commit
6c7e1ec3c9
|
@ -70,6 +70,10 @@ export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOp
|
|||
export function simplify(responseData: any | [any]) { // tslint:disable-line:no-any
|
||||
const response = [];
|
||||
for (const { columnHeader: { dimensions }, data: { rows } } of responseData) {
|
||||
if (rows === undefined) {
|
||||
// Do not error if there is no data
|
||||
continue;
|
||||
}
|
||||
for (const row of rows) {
|
||||
const data: IDataObject = {};
|
||||
if (dimensions) {
|
||||
|
|
|
@ -112,6 +112,15 @@ export class GoogleAnalytics implements INodeType {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
returnData.sort((a, b) => {
|
||||
const aName= a.name.toLowerCase();
|
||||
const bName= b.name.toLowerCase();
|
||||
if (aName < bName) { return -1; }
|
||||
if (aName > bName) { return 1; }
|
||||
return 0;
|
||||
});
|
||||
|
||||
return returnData;
|
||||
},
|
||||
// Get all the views to display them to user so that he can
|
||||
|
|
Loading…
Reference in a new issue