From 0fd8c21e38a8be975ad7ee307b54f1f0fef44fc6 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Wed, 26 Feb 2025 16:22:32 +0100 Subject: [PATCH 1/3] Small changes --- models/intermediate/resolutions/int_resolutions__incidents.sql | 2 +- models/staging/resolutions/stg_resolutions__incidents.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/intermediate/resolutions/int_resolutions__incidents.sql b/models/intermediate/resolutions/int_resolutions__incidents.sql index 3f31b6c..336ac12 100644 --- a/models/intermediate/resolutions/int_resolutions__incidents.sql +++ b/models/intermediate/resolutions/int_resolutions__incidents.sql @@ -125,7 +125,7 @@ with int_daily_currency_exchange_rates cer_gbp on dri.created_date_utc = cer_gbp.rate_date_utc and (cm.corrective_measure ->> 'Currency') = cer_gbp.from_currency - and cer.to_currency = 'GBP' + and cer_gbp.to_currency = 'GBP' group by dri.id_incident, dri.host_currency ), guest_amounts_in_gbp as ( diff --git a/models/staging/resolutions/stg_resolutions__incidents.sql b/models/staging/resolutions/stg_resolutions__incidents.sql index 3e2324c..c1f5a07 100644 --- a/models/staging/resolutions/stg_resolutions__incidents.sql +++ b/models/staging/resolutions/stg_resolutions__incidents.sql @@ -240,7 +240,7 @@ select ( {{ adapter.quote("documents") }} -> 'SavedCalculation' - ->> 'CalculatedGuestChargeAmountInUsd' + ->> 'SubmittedGuestChargeAmountInUsd' )::numeric as calculated_guest_charge_amount_in_usd, -- Third Party Compensation Claim From aaa0b1a5dd3008dd6cc106c12f13e63cfd54ca6e Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Wed, 26 Feb 2025 16:45:01 +0100 Subject: [PATCH 2/3] changed name --- .../int_resolutions__incidents.sql | 10 ++++----- models/intermediate/resolutions/schema.yml | 22 +++++++++---------- .../resolutions/resolutions__incidents.sql | 10 ++++----- models/reporting/resolutions/schema.yml | 22 +++++++++---------- models/staging/resolutions/schema.yml | 14 ++++++------ .../stg_resolutions__incidents.sql | 6 ++--- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/models/intermediate/resolutions/int_resolutions__incidents.sql b/models/intermediate/resolutions/int_resolutions__incidents.sql index 336ac12..a7e8726 100644 --- a/models/intermediate/resolutions/int_resolutions__incidents.sql +++ b/models/intermediate/resolutions/int_resolutions__incidents.sql @@ -192,12 +192,12 @@ select (i.calculated_payout_amount_in_usd * cer.rate)::decimal( 19, 4 ) as calculated_payout_amount_in_gbp, - i.calculated_guest_charge_amount_in_txn_currency, - i.calculated_guest_charge_currency, - i.calculated_guest_charge_amount_in_usd, - (i.calculated_guest_charge_amount_in_usd * cer.rate)::decimal( + i.submitted_guest_charge_amount_in_txn_currency, + i.submitted_guest_charge_currency, + i.submitted_guest_charge_amount_in_usd, + (i.submitted_guest_charge_amount_in_usd * cer.rate)::decimal( 19, 4 - ) as calculated_guest_charge_amount_in_gbp, + ) as submitted_guest_charge_amount_in_gbp, -- Host Details i.id_user_host, diff --git a/models/intermediate/resolutions/schema.yml b/models/intermediate/resolutions/schema.yml index 8b44fc0..5e9894a 100644 --- a/models/intermediate/resolutions/schema.yml +++ b/models/intermediate/resolutions/schema.yml @@ -211,32 +211,32 @@ models: min_value: 0 strictly: false - - name: calculated_guest_charge_amount_in_txn_currency - data_type: text - description: "Calculated guest charge amount in local currency." + - name: submitted_guest_charge_amount_in_txn_currency + data_type: numeric + description: "Submitted guest charge amount in local currency." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - - name: calculated_guest_charge_currency + - name: submitted_guest_charge_currency data_type: text - description: "Currency of the calculated guest charge amount." + description: "Currency of the submitted guest charge amount." data_tests: - not_null: - where: "calculated_guest_charge_amount_in_txn_currency > 0" + where: "submitted_guest_charge_amount_in_txn_currency > 0" - - name: calculated_guest_charge_amount_in_usd - data_type: text - description: "Calculated guest charge amount in USD." + - name: submitted_guest_charge_amount_in_usd + data_type: numeric + description: "Submitted guest charge amount in USD." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - - name: calculated_guest_charge_amount_in_gbp + - name: submitted_guest_charge_amount_in_gbp data_type: text - description: "Calculated guest charge amount in GBP." + description: "Submitted guest charge amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 diff --git a/models/reporting/resolutions/resolutions__incidents.sql b/models/reporting/resolutions/resolutions__incidents.sql index c2e234c..4b97413 100644 --- a/models/reporting/resolutions/resolutions__incidents.sql +++ b/models/reporting/resolutions/resolutions__incidents.sql @@ -39,11 +39,11 @@ select calculated_payout_currency as calculated_payout_currency, calculated_payout_amount_in_usd as calculated_payout_amount_in_usd, calculated_payout_amount_in_gbp as calculated_payout_amount_in_gbp, - calculated_guest_charge_amount_in_txn_currency - as calculated_guest_charge_amount_in_txn_currency, - calculated_guest_charge_currency as calculated_guest_charge_currency, - calculated_guest_charge_amount_in_usd as calculated_guest_charge_amount_in_usd, - calculated_guest_charge_amount_in_gbp as calculated_guest_charge_amount_in_gbp, + submitted_guest_charge_amount_in_txn_currency + as submitted_guest_charge_amount_in_txn_currency, + submitted_guest_charge_currency as submitted_guest_charge_currency, + submitted_guest_charge_amount_in_usd as submitted_guest_charge_amount_in_usd, + submitted_guest_charge_amount_in_gbp as submitted_guest_charge_amount_in_gbp, id_user_host as id_user_host, host_account_name as host_account_name, host_email as host_email, diff --git a/models/reporting/resolutions/schema.yml b/models/reporting/resolutions/schema.yml index 62e55ea..564883b 100644 --- a/models/reporting/resolutions/schema.yml +++ b/models/reporting/resolutions/schema.yml @@ -211,32 +211,32 @@ models: min_value: 0 strictly: false - - name: calculated_guest_charge_amount_in_txn_currency - data_type: text - description: "Calculated guest charge amount in local currency." + - name: submitted_guest_charge_amount_in_txn_currency + data_type: numeric + description: "Submitted guest charge amount in local currency." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - - name: calculated_guest_charge_currency + - name: submitted_guest_charge_currency data_type: text - description: "Currency of the calculated guest charge amount." + description: "Currency of the submitted guest charge amount." data_tests: - not_null: - where: "calculated_guest_charge_amount_in_txn_currency > 0" + where: "submitted_guest_charge_amount_in_txn_currency > 0" - - name: calculated_guest_charge_amount_in_usd - data_type: text - description: "Calculated guest charge amount in USD." + - name: submitted_guest_charge_amount_in_usd + data_type: numeric + description: "Submitted guest charge amount in USD." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - - name: calculated_guest_charge_amount_in_gbp + - name: submitted_guest_charge_amount_in_gbp data_type: text - description: "Calculated guest charge amount in GBP." + description: "Submitted guest charge amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 diff --git a/models/staging/resolutions/schema.yml b/models/staging/resolutions/schema.yml index fcf6233..3e80918 100644 --- a/models/staging/resolutions/schema.yml +++ b/models/staging/resolutions/schema.yml @@ -365,24 +365,24 @@ models: min_value: 0 strictly: false - - name: calculated_guest_charge_amount_in_txn_currency + - name: submitted_guest_charge_amount_in_txn_currency data_type: numeric - description: "Calculated guest charge amount in local currency." + description: "Submitted guest charge amount in local currency." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - - name: calculated_guest_charge_currency + - name: submitted_guest_charge_currency data_type: text - description: "Currency of the calculated guest charge amount." + description: "Currency of the submitted guest charge amount." data_tests: - not_null: - where: "calculated_guest_charge_amount_in_txn_currency > 0" + where: "submitted_guest_charge_amount_in_txn_currency > 0" - - name: calculated_guest_charge_amount_in_usd + - name: submitted_guest_charge_amount_in_usd data_type: numeric - description: "Calculated guest charge amount in USD." + description: "Submitted guest charge amount in USD." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 diff --git a/models/staging/resolutions/stg_resolutions__incidents.sql b/models/staging/resolutions/stg_resolutions__incidents.sql index c1f5a07..af62730 100644 --- a/models/staging/resolutions/stg_resolutions__incidents.sql +++ b/models/staging/resolutions/stg_resolutions__incidents.sql @@ -233,15 +233,15 @@ select {{ adapter.quote("documents") }} -> 'SavedCalculation' ->> 'SubmittedGuestChargeAmount' - )::numeric as calculated_guest_charge_amount_in_txn_currency, + )::numeric as submitted_guest_charge_amount_in_txn_currency, {{ adapter.quote("documents") }} -> 'SavedCalculation' - ->> 'SubmittedGuestChargeCurrency' as calculated_guest_charge_currency, + ->> 'SubmittedGuestChargeCurrency' as submitted_guest_charge_currency, ( {{ adapter.quote("documents") }} -> 'SavedCalculation' ->> 'SubmittedGuestChargeAmountInUsd' - )::numeric as calculated_guest_charge_amount_in_usd, + )::numeric as submitted_guest_charge_amount_in_usd, -- Third Party Compensation Claim ( From 6f28c4d9dc7246c76ab14fd724efd9e0c10ddc2d Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Wed, 26 Feb 2025 16:51:56 +0100 Subject: [PATCH 3/3] numeric --- models/intermediate/resolutions/schema.yml | 8 ++++---- models/reporting/resolutions/schema.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/models/intermediate/resolutions/schema.yml b/models/intermediate/resolutions/schema.yml index 5e9894a..a018db3 100644 --- a/models/intermediate/resolutions/schema.yml +++ b/models/intermediate/resolutions/schema.yml @@ -181,7 +181,7 @@ models: strictly: false - name: calculated_payout_amount_in_txn_currency - data_type: text + data_type: numeric description: "Calculated payout amount in local currency." data_tests: - dbt_expectations.expect_column_values_to_be_between: @@ -196,7 +196,7 @@ models: where: "calculated_payout_amount_in_txn_currency > 0" - name: calculated_payout_amount_in_usd - data_type: text + data_type: numeric description: "Calculated payout amount in USD." data_tests: - dbt_expectations.expect_column_values_to_be_between: @@ -204,7 +204,7 @@ models: strictly: false - name: calculated_payout_amount_in_gbp - data_type: text + data_type: numeric description: "Calculated payout amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: @@ -235,7 +235,7 @@ models: strictly: false - name: submitted_guest_charge_amount_in_gbp - data_type: text + data_type: numeric description: "Submitted guest charge amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: diff --git a/models/reporting/resolutions/schema.yml b/models/reporting/resolutions/schema.yml index 564883b..cac8c09 100644 --- a/models/reporting/resolutions/schema.yml +++ b/models/reporting/resolutions/schema.yml @@ -181,7 +181,7 @@ models: strictly: false - name: calculated_payout_amount_in_txn_currency - data_type: text + data_type: numeric description: "Calculated payout amount in local currency." data_tests: - dbt_expectations.expect_column_values_to_be_between: @@ -196,7 +196,7 @@ models: where: "calculated_payout_amount_in_txn_currency > 0" - name: calculated_payout_amount_in_usd - data_type: text + data_type: numeric description: "Calculated payout amount in USD." data_tests: - dbt_expectations.expect_column_values_to_be_between: @@ -204,7 +204,7 @@ models: strictly: false - name: calculated_payout_amount_in_gbp - data_type: text + data_type: numeric description: "Calculated payout amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: @@ -235,7 +235,7 @@ models: strictly: false - name: submitted_guest_charge_amount_in_gbp - data_type: text + data_type: numeric description: "Submitted guest charge amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: