Skip to content

Commit 43b1a97

Browse files
committed
keep absolute origins
1 parent 4149950 commit 43b1a97

2 files changed

Lines changed: 44 additions & 49 deletions

File tree

definitions/output/reports/tech_crux.js

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -294,40 +294,6 @@ lab_data AS (
294294
version
295295
),
296296
297-
audits AS (
298-
SELECT
299-
geo,
300-
client,
301-
rank,
302-
technology,
303-
version,
304-
category,
305-
id,
306-
COUNT(DISTINCT root_page) AS origins
307-
FROM (
308-
SELECT DISTINCT
309-
client,
310-
page,
311-
root_page,
312-
audits.category,
313-
audits.id
314-
FROM pages
315-
INNER JOIN UNNEST(get_passed_audits(pages.lighthouse)) AS audits
316-
) AS audits_data
317-
INNER JOIN technologies
318-
USING (client, page)
319-
INNER JOIN crux
320-
USING (client, root_page)
321-
GROUP BY
322-
geo,
323-
client,
324-
rank,
325-
technology,
326-
version,
327-
category,
328-
id
329-
),
330-
331297
base_summary AS (
332298
SELECT
333299
geo,
@@ -387,14 +353,43 @@ audits_summary AS (
387353
technology,
388354
version,
389355
ARRAY_AGG(STRUCT(
390-
category AS category,
391-
id AS id,
392-
audits.origins AS origins,
393-
SAFE_DIVIDE(audits.origins, base_summary.origins) AS pass_rate
356+
category,
357+
id,
358+
pass_origins
394359
)) AS audits
395-
FROM audits
396-
LEFT JOIN base_summary
397-
USING (geo, client, rank, technology, version)
360+
FROM (
361+
SELECT
362+
geo,
363+
client,
364+
rank,
365+
technology,
366+
version,
367+
category,
368+
id,
369+
COUNT(DISTINCT root_page) AS pass_origins
370+
FROM (
371+
SELECT DISTINCT
372+
client,
373+
page,
374+
root_page,
375+
audits.category,
376+
audits.id
377+
FROM pages
378+
INNER JOIN UNNEST(get_passed_audits(pages.lighthouse)) AS audits
379+
) AS audits_data
380+
INNER JOIN technologies
381+
USING (client, page)
382+
INNER JOIN crux
383+
USING (client, root_page)
384+
GROUP BY
385+
geo,
386+
client,
387+
rank,
388+
technology,
389+
version,
390+
category,
391+
id
392+
)
398393
GROUP BY
399394
geo,
400395
client,

definitions/output/reports/tech_report_audits.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ CREATE TEMP FUNCTION GET_AUDITS(
1616
audits ARRAY<STRUCT<
1717
category STRING,
1818
id STRING,
19-
pass_rate FLOAT64
19+
pass_origins FLOAT64
2020
>>
2121
>>
2222
)
2323
RETURNS ARRAY<STRUCT<
2424
category STRING,
2525
id STRING,
2626
mobile STRUCT<
27-
pass_rate FLOAT64
27+
pass_origins FLOAT64
2828
>,
2929
desktop STRUCT<
30-
pass_rate FLOAT64
30+
pass_origins FLOAT64
3131
>
3232
>>
3333
LANGUAGE js AS '''
@@ -45,15 +45,15 @@ records.forEach(function(record) {
4545
auditMap[key] = {
4646
category: audit.category,
4747
id: audit.id,
48-
mobile: { pass_rate: 0 },
49-
desktop: { pass_rate: 0 }
48+
mobile: { pass_origins: 0 },
49+
desktop: { pass_origins: 0 }
5050
};
5151
}
52-
// Add the pass_rate to the proper client type.
52+
// Add the pass_origins to the proper client type.
5353
if (record.client === 'mobile') {
54-
auditMap[key].mobile.pass_rate += audit.pass_rate;
54+
auditMap[key].mobile.pass_origins += audit.pass_origins;
5555
} else if (record.client === 'desktop') {
56-
auditMap[key].desktop.pass_rate += audit.pass_rate;
56+
auditMap[key].desktop.pass_origins += audit.pass_origins;
5757
}
5858
});
5959
});

0 commit comments

Comments
 (0)