diff --git a/models/intermediate/athena/int_athena__verifications.sql b/models/intermediate/athena/int_athena__verifications.sql index b54e6a4..97e5c30 100644 --- a/models/intermediate/athena/int_athena__verifications.sql +++ b/models/intermediate/athena/int_athena__verifications.sql @@ -1,3 +1,5 @@ +{% set nightly_fee_local = 2 %} + with stg_athena__verifications as (select * from {{ ref("stg_athena__verifications") }}) select -- note that these ids are not the same as the ones found in Core DWH @@ -9,7 +11,7 @@ select version, case when version = 'V1' then 'Guesty' else null end as verification_source, verification_status, - nightly_fee_local, + {{ nightly_fee_local }} as nightly_fee_local, cast(checkout_at_utc as date) - cast(checkin_at_utc as date) as number_nights, email_flag, phone_flag, @@ -27,13 +29,15 @@ select guest_last_name, guest_first_name, guest_telephone, - company_name, property_manager_name, property_manager_email, listing_name, + listing_address, listing_town, listing_country, listing_postcode, + level_of_protection_amount, + level_of_protection_currency, pets_allowed, status_updated_at_utc, status_updated_date_utc, diff --git a/models/intermediate/athena/schema.yml b/models/intermediate/athena/schema.yml index d081148..4ec24d2 100644 --- a/models/intermediate/athena/schema.yml +++ b/models/intermediate/athena/schema.yml @@ -57,7 +57,7 @@ models: - name: nightly_fee_local data_type: double precision - description: "fee charged per night" + description: "fee in local currency charged per night" - name: number_nights data_type: integer @@ -127,10 +127,6 @@ models: data_type: text description: "" - - name: company_name - data_type: text - description: "" - - name: property_manager_name data_type: text description: "" @@ -143,6 +139,10 @@ models: data_type: text description: "" + - name: listing_address + data_type: text + description: "" + - name: listing_town data_type: text description: "" diff --git a/models/intermediate/cross/int_edeposit_and_athena_verifications.sql b/models/intermediate/cross/int_edeposit_and_athena_verifications.sql index db43c0b..84ad94a 100644 --- a/models/intermediate/cross/int_edeposit_and_athena_verifications.sql +++ b/models/intermediate/cross/int_edeposit_and_athena_verifications.sql @@ -13,7 +13,11 @@ select av.verification_status, av.nightly_fee_local, av.number_nights, - av.nightly_fee_local * av.number_nights as total_fee_local, + case + when av.number_nights = 0 + then av.nightly_fee_local + else av.nightly_fee_local * av.number_nights + end as total_fee_local, av.email_flag, av.phone_flag, av.watch_list, @@ -30,13 +34,16 @@ select av.guest_last_name, av.guest_first_name, av.guest_telephone, - av.company_name, + null as company_name, av.property_manager_name, av.property_manager_email, av.listing_name, + av.listing_address, av.listing_town, av.listing_country, av.listing_postcode, + av.level_of_protection_amount, + av.level_of_protection_currency, av.pets_allowed, av.status_updated_at_utc, av.status_updated_date_utc, @@ -75,12 +82,15 @@ select ev.guest_first_name, ev.guest_telephone, ev.company_name, - ev.property_manager_name, - ev.property_manager_email, + null as property_manager_name, + null as property_manager_email, ev.listing_name, + ev.listing_address, ev.listing_town, ev.listing_country, ev.listing_postcode, + null as level_of_protection_amount, + null as level_of_protection_currency, ev.pets_allowed, ev.status_updated_at_utc, ev.status_updated_date_utc, diff --git a/models/intermediate/cross/schema.yml b/models/intermediate/cross/schema.yml index efef2f1..cd6a8e0 100644 --- a/models/intermediate/cross/schema.yml +++ b/models/intermediate/cross/schema.yml @@ -1240,7 +1240,7 @@ models: - name: nightly_fee_local data_type: double precision - description: "fee charged per night" + description: "fee in local currency charged per night" - name: number_nights data_type: integer @@ -1248,7 +1248,7 @@ models: - name: total_fee_local data_type: double precision - description: "total fee for the booking" + description: "total fee in local currency for the booking" - name: email_flag data_type: text @@ -1330,6 +1330,10 @@ models: data_type: text description: "" + - name: listing_address + data_type: text + description: "" + - name: listing_town data_type: text description: "" diff --git a/models/intermediate/edeposit/int_edeposit__verifications.sql b/models/intermediate/edeposit/int_edeposit__verifications.sql index a7c8df0..6a27804 100644 --- a/models/intermediate/edeposit/int_edeposit__verifications.sql +++ b/models/intermediate/edeposit/int_edeposit__verifications.sql @@ -31,9 +31,8 @@ select guest_first_name, guest_telephone, company_name, - property_manager_name, - property_manager_email, listing_name, + listing_address, listing_town, listing_country, listing_postcode, diff --git a/models/intermediate/edeposit/schema.yml b/models/intermediate/edeposit/schema.yml index 9356e25..79bd29b 100644 --- a/models/intermediate/edeposit/schema.yml +++ b/models/intermediate/edeposit/schema.yml @@ -58,7 +58,7 @@ models: - name: nightly_fee_local data_type: double precision - description: "fee charged per night" + description: "fee in local currency charged per night" - name: number_nights data_type: integer @@ -132,18 +132,14 @@ models: data_type: text description: "" - - name: property_manager_name - data_type: text - description: "" - - - name: property_manager_email - data_type: text - description: "" - - name: listing_name data_type: text description: "" + - name: listing_address + data_type: text + description: "" + - name: listing_town data_type: text description: "" @@ -160,14 +156,6 @@ models: data_type: boolean description: "" - - name: level_of_protection_amount - data_type: integer - description: "" - - - name: level_of_protection_currency - data_type: text - description: "" - - name: status_updated_at_utc data_type: timestamp without time zone description: "Timestamp when status was last updated" diff --git a/models/reporting/cross/edeposit_and_athena_verifications.sql b/models/reporting/cross/edeposit_and_athena_verifications.sql index 8a50fdd..a66e96c 100644 --- a/models/reporting/cross/edeposit_and_athena_verifications.sql +++ b/models/reporting/cross/edeposit_and_athena_verifications.sql @@ -33,9 +33,12 @@ select eav.property_manager_name as property_manager_name, eav.property_manager_email as property_manager_email, eav.listing_name as listing_name, + eav.listing_address as listing_address, eav.listing_town as listing_town, eav.listing_country as listing_country, eav.listing_postcode as listing_postcode, + eav.level_of_protection_amount as level_of_protection_amount, + eav.level_of_protection_currency as level_of_protection_currency, eav.pets_allowed as pets_allowed, eav.status_updated_at_utc as status_updated_at_utc, eav.status_updated_date_utc as status_updated_date_utc, diff --git a/models/reporting/cross/schema.yml b/models/reporting/cross/schema.yml index 7587529..9d95d0d 100644 --- a/models/reporting/cross/schema.yml +++ b/models/reporting/cross/schema.yml @@ -57,7 +57,7 @@ models: - name: nightly_fee_local data_type: double precision - description: "fee charged per night" + description: "fee in local currency charged per night" - name: number_nights data_type: integer @@ -65,7 +65,7 @@ models: - name: total_fee_local data_type: double precision - description: "total fee for the booking" + description: "total fee in local currency for the booking" - name: email_flag data_type: text @@ -147,6 +147,10 @@ models: data_type: text description: "" + - name: listing_address + data_type: text + description: "" + - name: listing_town data_type: text description: ""