From: colemanw Date: Tue, 29 Aug 2023 18:54:25 +0000 (-0400) Subject: SearchKit - Fix broken totals row and query output X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7dc1a37e806bb674a6e5929a1a9a1db546c03aab;p=civicrm-core.git SearchKit - Fix broken totals row and query output This regressed in ef1cbd --- diff --git a/ext/search_kit/ang/crmSearchAdmin/resultsTable/crmSearchAdminResultsTable.component.js b/ext/search_kit/ang/crmSearchAdmin/resultsTable/crmSearchAdminResultsTable.component.js index 68c2dbda74..b682eaa657 100644 --- a/ext/search_kit/ang/crmSearchAdmin/resultsTable/crmSearchAdminResultsTable.component.js +++ b/ext/search_kit/ang/crmSearchAdmin/resultsTable/crmSearchAdminResultsTable.component.js @@ -43,10 +43,12 @@ // Add callbacks for pre & post run this.onPreRun.push(function(apiCalls) { - apiCalls.run.debug = true; + // So the raw SQL can be shown in the "Query Info" tab + apiCalls.run[2].debug = true; }); this.onPostRun.push(function(apiResults) { + // Add debug output (e.g. raw SQL) to the "Query Info" tab ctrl.debug = _.extend(_.pick(ctrl.debug, 'apiParams'), apiResults.run.debug); }); diff --git a/ext/search_kit/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js b/ext/search_kit/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js index 59372abd76..7530c34153 100644 --- a/ext/search_kit/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js +++ b/ext/search_kit/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js @@ -22,10 +22,11 @@ this.$onInit = function() { var tallyParams; + // Copy API params from the run and adapt them in a secondary `tally` call for the "Totals" row if (ctrl.settings.tally) { ctrl.onPreRun.push(function (apiCalls) { ctrl.tally = null; - tallyParams = _.cloneDeep(apiCalls.run); + tallyParams = _.cloneDeep(apiCalls.run[2]); }); ctrl.onPostRun.push(function (apiResults, status) {