Skip to content

Commit 76135c1

Browse files
committed
fix: Usage of outdated response format.
1 parent f1b6d61 commit 76135c1

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

nerdlets/shared/components/stat-utils.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function buildSatisfied(cohorts, satisfied, bounceRate) {
4646
obj.raw = {};
4747
const SbounceRate = !bounceRate
4848
? null
49-
: bounceRate.results.find((r) => r.facet === 'S');
49+
: bounceRate.rawResponse.facets.find((r) => r.name === 'S');
5050
const S =
5151
cohorts && cohorts.results
5252
? cohorts.results.find((c) => c.facet === 'S')
@@ -60,7 +60,7 @@ function buildTolerated(cohorts, tolerated, bounceRate) {
6060
obj.raw = {};
6161
const TbounceRate = !bounceRate
6262
? null
63-
: bounceRate.results.find((r) => r.facet === 'T');
63+
: bounceRate.rawResponse.facets.find((r) => r.name === 'T');
6464
const T =
6565
cohorts && cohorts.results
6666
? cohorts.results.find((c) => c.facet === 'T')
@@ -74,7 +74,7 @@ function buildFrustrated(cohorts, frustrated, bounceRate) {
7474
obj.raw = {};
7575
const FbounceRate = !bounceRate
7676
? null
77-
: bounceRate.results.find((r) => r.facet === 'F');
77+
: bounceRate.rawResponse.facets.find((r) => r.name === 'F');
7878
const F =
7979
cohorts && cohorts.results
8080
? cohorts.results.find((c) => c.facet === 'F')
@@ -102,11 +102,15 @@ function fillObject(obj, sample, cohort, bounceCohort) {
102102
obj.bounces = calcBounces(sample.results);
103103
}
104104

105-
if (bounceCohort) {
106-
obj.raw.bounceCohort = { ...bounceCohort };
107-
obj.bounces = bounceCohort.steps[0] - bounceCohort.steps[1];
108-
obj.totalSamples = bounceCohort.steps[0];
105+
if (bounceCohort && bounceCohort.results && bounceCohort.results.length > 0) {
106+
bounceCohort = bounceCohort.results[0];
107+
if (bounceCohort.steps) {
108+
obj.raw.bounceCohort = { ...bounceCohort };
109+
obj.bounces = bounceCohort.steps[0] - bounceCohort.steps[1];
110+
obj.totalSamples = bounceCohort.steps[0];
111+
}
109112
}
113+
110114
return obj;
111115
}
112116

nerdlets/shared/nrql-factory/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ class SPAFactory extends NrqlFactory {
301301
targetUrl ? `WHERE targetUrl != '${targetUrl}'` : ''
302302
} as 'nextPage') ${facetCaseStmt}") {
303303
results
304+
rawResponse
304305
}`
305306
: ''
306307
}

0 commit comments

Comments
 (0)