Skip to content

Commit

Permalink
do not forward idGoal if requesting a Goals API method + update expec…
Browse files Browse the repository at this point in the history
…ted files
  • Loading branch information
diosmosis committed Apr 26, 2024
1 parent 8c1e497 commit 87cf268
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 249 deletions.
14 changes: 10 additions & 4 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,8 @@ function getReportData(request: GoogleAppsScript.Data_Studio.Request<ConnectorPa
let hasMoreRowsToFetch = true;
while (hasMoreRowsToFetch) {
const limitToUse = filter_truncate < 0 || filter_truncate >= rowsToFetchAtATime ? rowsToFetchAtATime : filter_truncate;
let partialResponseRaw = Api.fetch<DataTableRow[]|Record<string, DataTableRow[]>>(`${reportParams.apiModule}.${reportParams.apiAction}`, {
filter_update_columns_when_show_all_goals: '1',
idGoal: '0', // calculate extra metrics for all goals

const params: Record<string, string> = {
...reportParams,
idSite: `${idSite}`,
period,
Expand All @@ -260,7 +259,14 @@ function getReportData(request: GoogleAppsScript.Data_Studio.Request<ConnectorPa
filter_limit: `${limitToUse}`,
filter_offset: `${offset}`,
showColumns,
}, {
};

if (reportParams.apiModule !== 'Goals') {
params.filter_update_columns_when_show_all_goals = '1';
params.idGoal = '0'; // calculate extra metrics for all goals
}

let partialResponseRaw = Api.fetch<DataTableRow[]|Record<string, DataTableRow[]>>(`${reportParams.apiModule}.${reportParams.apiAction}`, params, {
checkRuntimeLimit: true,
runtimeLimitAbortMessage: pastScriptRuntimeLimitErrorMessage,
});
Expand Down
8 changes: 4 additions & 4 deletions tests/appscript/expected/data_Referrers.getKeywords.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@
"0",
"0",
"0",
"1",
"1",
"0",
"0",
"0",
Expand All @@ -191,16 +193,14 @@
"0",
"0",
"0",
"0.01",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0.0082",
"0",
"0",
"0"
Expand Down
42 changes: 21 additions & 21 deletions tests/appscript/expected/data_Referrers.getReferrerType.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@
"1.3",
"56",
"0.83",
"1",
"1",
"0",
"0",
"5",
"10",
"51",
"51",
"19",
"0",
"4",
"0",
"0",
"0",
"0",
"0",
"0.01",
"0.05",
"0",
"0",
"0",
"0.0009",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0.0045",
"0.0456",
"0.017",
"0.0036",
"0"
]
},
Expand All @@ -55,6 +55,8 @@
"0",
"0",
"0",
"1",
"2",
"0",
"0",
"0",
Expand All @@ -72,9 +74,7 @@
"0",
"0",
"0",
"0",
"0",
"0",
"0.0023",
"0",
"0",
"0",
Expand Down Expand Up @@ -131,6 +131,8 @@
"2.1",
"197",
"0.48",
"1",
"1",
"0",
"0",
"0",
Expand All @@ -150,9 +152,7 @@
"0",
"0",
"0",
"0",
"0",
"0",
"0.0033",
"0",
"0",
"0",
Expand Down
82 changes: 41 additions & 41 deletions tests/appscript/expected/data_UserCountry.getCity.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@
"1.4",
"84",
"0.76",
"2",
"2",
"0",
"0",
"1",
"2",
"21",
"21",
"8",
"0",
"2",
"0",
"0",
"0",
"0",
"0",
"0",
"0.05",
"0",
"0",
"0",
"0.0046",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0.0023",
"0.0483",
"0.0184",
"0.0046",
"0"
]
},
Expand All @@ -53,28 +53,28 @@
"0",
"0",
"0",
"2",
"4",
"10",
"10",
"3",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0.01",
"0.03",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0.0051",
"0.0253",
"0.0076",
"0",
"0"
]
Expand All @@ -94,6 +94,8 @@
"0",
"0",
"0",
"2",
"2",
"0",
"0",
"0",
Expand All @@ -103,16 +105,14 @@
"0",
"0",
"0",
"0.05",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0.0513",
"0",
"0",
"0"
Expand All @@ -135,6 +135,7 @@
"0",
"0",
"0",
"1",
"0",
"0",
"0",
Expand All @@ -151,8 +152,7 @@
"0",
"0",
"0",
"0",
"0",
"0.0294",
"0",
"0"
]
Expand All @@ -170,29 +170,29 @@
"0",
"0",
"0",
"3",
"6",
"18",
"18",
"7",
"0",
"2",
"0",
"0",
"0",
"0",
"0",
"0",
"0.01",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0.0024",
"0.0141",
"0.0055",
"0.0016",
"0"
]
}
Expand Down
Loading

0 comments on commit 87cf268

Please sign in to comment.