Merged PR 4546: Calculator changes

# Description

After talking with the Ant he we realised that the `was_overriden` was not properly set up so I removed it.
Added all calculated and submitted values for both guests and hosts and left out values in USD since we are not going to use them on the report.

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Calculator changes

Related work items: #27812
This commit is contained in:
Joaquin Ossa 2025-02-28 11:25:29 +00:00
commit b2e15bbbab
6 changed files with 176 additions and 52 deletions

View file

@ -189,20 +189,27 @@ select
-- Resolutions calculator
i.protection_name,
i.was_overriden,
i.waiver_or_deposit_name,
i.guest_verification_status,
i.lower_protection_limit_usd,
i.upper_protection_limit_usd,
i.calculated_payout_amount_in_txn_currency,
i.calculated_payout_currency,
i.calculated_payout_amount_in_usd,
(i.calculated_payout_amount_in_usd * cer.rate)::decimal(
19, 4
) as calculated_payout_amount_in_gbp,
i.submitted_payout_amount_in_txn_currency,
i.submitted_payout_currency,
(i.submitted_payout_amount_in_usd * cer.rate)::decimal(
19, 4
) as submitted_payout_amount_in_gbp,
i.calculated_guest_charge_amount_in_txn_currency,
i.calculated_guest_charge_currency,
(i.calculated_guest_charge_amount_in_usd * cer.rate)::decimal(
19, 4
) as calculated_guest_charge_amount_in_gbp,
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 submitted_guest_charge_amount_in_gbp,

View file

@ -162,12 +162,6 @@ models:
or asked_repair_amount_in_host_currency > 0
or accepted_amount_in_host_currency > 0"
- name: was_overriden
data_type: boolean
description: |
"Flag to indicate if the proposed settlement value from the
calculator was overridden."
- name: guest_verification_status
data_type: text
description: "Guest verification status for this booking."
@ -203,17 +197,55 @@ models:
- not_null:
where: "calculated_payout_amount_in_txn_currency > 0"
- name: calculated_payout_amount_in_usd
- name: calculated_payout_amount_in_gbp
data_type: numeric
description: "Calculated payout amount in USD."
description: "Calculated payout amount in GBP."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: calculated_payout_amount_in_gbp
- name: submitted_payout_amount_in_txn_currency
data_type: numeric
description: "Calculated payout amount in GBP."
description: "Submitted payout amount in local currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: submitted_payout_currency
data_type: text
description: "Currency of the submitted payout amount."
data_tests:
- not_null:
where: "submitted_payout_amount_in_txn_currency > 0"
- name: submitted_payout_amount_in_gbp
data_type: numeric
description: "Submitted payout amount in GBP."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: calculated_guest_charge_amount_in_txn_currency
data_type: numeric
description: "Calculated 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
data_type: text
description: "Currency of the calculated guest charge amount."
data_tests:
- not_null:
where: "calculated_guest_charge_amount_in_txn_currency > 0"
- name: calculated_guest_charge_amount_in_gbp
data_type: numeric
description: "Calculated guest charge amount in GBP."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
@ -234,14 +266,6 @@ models:
- not_null:
where: "submitted_guest_charge_amount_in_txn_currency > 0"
- 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: submitted_guest_charge_amount_in_gbp
data_type: numeric
description: "Submitted guest charge amount in GBP."