Skip to content

Commit ce88134

Browse files
committed
fix: use correct references and types for fields inside terms_of_use_status_v1 template
1 parent 47f69b3 commit ce88134

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

sql_generators/terms_of_use/templates/terms_of_use_status_v1/query.sql.jinja

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
WITH _previous AS (
33
SELECT
44
submission_timestamp,
5-
client_info.client_id,
6-
app_version_major
5+
client_id,
6+
app_version_major,
77
app_version_minor,
88
app_version_patch,
99
normalized_channel,
@@ -15,12 +15,12 @@ WITH _previous AS (
1515
terms_of_use_version_accepted,
1616
terms_of_use_date_accepted,
1717
{% if app_name == "firefox_desktop" %}
18-
metrics.metrics.uuid.legacy_telemetry_client_id, -- firefox_desktop exclusive field.
18+
legacy_telemetry_client_id, -- firefox_desktop exclusive field.
1919
{% endif %}
2020
FROM
2121
`{{ project_id }}.{{ app_name }}_derived.{{ table_name }}`
2222
WHERE
23-
DATE(submission_timestamp) <= @submission_date
23+
DATE(submission_timestamp) <> @submission_date
2424
),
2525
_current AS (
2626
SELECT
@@ -36,22 +36,29 @@ _current AS (
3636
is_bot_generated,
3737
metadata.isp.name AS isp_name,
3838
{% if app_name == "firefox_ios" %}
39-
metrics.metrics.quantity.user_terms_of_use_version_accepted AS terms_of_use_version_accepted,
40-
metrics.metrics.datetime.user_terms_of_use_date_accepted AS terms_of_use_date_accepted,
39+
metrics.quantity.user_terms_of_use_version_accepted AS terms_of_use_version_accepted,
40+
metrics.datetime.user_terms_of_use_date_accepted AS terms_of_use_date_accepted,
4141
{% elif app_name == "fenix" %}
42-
metrics.metrics.quantity.terms_of_use_version AS terms_of_use_version_accepted,
43-
metrics.metrics.datetime.terms_of_use_date AS terms_of_use_date_accepted,
42+
metrics.quantity.terms_of_use_version AS terms_of_use_version_accepted,
43+
metrics.datetime.terms_of_use_date AS terms_of_use_date_accepted,
4444
{% elif app_name == "firefox_desktop" %}
4545
metrics.quantity.termsofuse_version AS terms_of_use_version_accepted,
4646
metrics.datetime.termsofuse_date AS terms_of_use_date_accepted,
47-
metrics.metrics.uuid.legacy_telemetry_client_id, -- firefox_desktop exclusive field.
47+
metrics.uuid.legacy_telemetry_client_id, -- firefox_desktop exclusive field.
4848
{% endif %}
4949
FROM
5050
`{{ project_id }}.{{ app_name }}.metrics`
5151
WHERE
52-
DATE(submission_timestamp) >= {% if app_name == "firefox_desktop" %}"2025-06-24"{% else %}"2025-09-15"{% endif %}
52+
DATE(submission_timestamp) = @submission_date
53+
AND DATE(submission_timestamp) >= {% if app_name == "firefox_desktop" %}"2025-06-24"{% else %}"2025-09-15"{% endif %}
5354
AND app_version_major >= 142
54-
AND metrics.metrics.datetime.user_terms_of_use_date_accepted IS NOT NULL
55+
{% if app_name == "firefox_ios" %}
56+
AND metrics.datetime.user_terms_of_use_date_accepted IS NOT NULL
57+
{% elif app_name == "fenix" %}
58+
AND metrics.datetime.terms_of_use_date IS NOT NULL
59+
{% elif app_name == "firefox_desktop" %}
60+
AND metrics.datetime.termsofuse_date IS NOT NULL
61+
{% endif %}
5562
)
5663

5764
SELECT

sql_generators/terms_of_use/templates/terms_of_use_status_v1/schema.yaml.jinja

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ fields:
1515

1616
- mode: NULLABLE
1717
name: app_version_major
18-
type: INTEGER
18+
type: NUMERIC
1919
description: |
2020
The user visible major version of the Firefox app.
2121

2222
- mode: NULLABLE
2323
name: app_version_minor
24-
type: INTEGER
24+
type: NUMERIC
2525
description: |
2626
The user visible minor version of the Firefox app.
2727

2828
- mode: NULLABLE
2929
name: app_version_patch
30-
type: INTEGER
30+
type: NUMERIC
3131
description: |
3232
The user visible patch version of the Firefox app.
3333

@@ -57,7 +57,7 @@ fields:
5757

5858
- mode: NULLABLE
5959
name: is_bot_generated
60-
type: STRING
60+
type: BOOLEAN
6161
description: |
6262
Indicates if the client is a bot.
6363

@@ -69,7 +69,7 @@ fields:
6969

7070
- mode: NULLABLE
7171
name: terms_of_use_version_accepted
72-
type: STRING
72+
type: INTEGER
7373
description: |
7474
The version of the Terms of Use the user accepted.
7575

0 commit comments

Comments
 (0)