finished schema
This commit is contained in:
parent
8b7dfa0839
commit
63a2eff6e2
2 changed files with 93 additions and 90 deletions
|
|
@ -72,16 +72,16 @@ with
|
|||
select
|
||||
-- Basic Incident Details
|
||||
i.id_incident,
|
||||
id_user,
|
||||
id_verification,
|
||||
current_status_name,
|
||||
is_submission_complete,
|
||||
current_agent_name,
|
||||
document_version,
|
||||
created_at_utc,
|
||||
created_date_utc,
|
||||
updated_at_utc,
|
||||
updated_date_utc,
|
||||
i.id_user,
|
||||
i.id_verification,
|
||||
i.current_status_name,
|
||||
i.is_submission_complete,
|
||||
i.current_agent_name,
|
||||
i.document_version,
|
||||
i.created_at_utc,
|
||||
i.created_date_utc,
|
||||
i.updated_at_utc,
|
||||
i.updated_date_utc,
|
||||
|
||||
-- Resolution Details
|
||||
lt.first_comment_at_utc,
|
||||
|
|
@ -90,7 +90,7 @@ select
|
|||
lt.first_status_at_utc,
|
||||
lt.last_status_at_utc,
|
||||
case
|
||||
when is_submission_complete
|
||||
when i.is_submission_complete
|
||||
then
|
||||
(
|
||||
extract(epoch from (lt.last_status_at_utc - lt.first_status_at_utc))
|
||||
|
|
@ -104,65 +104,65 @@ select
|
|||
dr.accepted_amount_in_txn_currency,
|
||||
|
||||
-- Resolutions calculator
|
||||
protection_name,
|
||||
was_overriden,
|
||||
waiver_or_deposit_name,
|
||||
guest_verification_status,
|
||||
lower_protection_limit_usd,
|
||||
upper_protection_limit_usd,
|
||||
calculated_payout_amount_in_txn_currency,
|
||||
calculated_payout_currency,
|
||||
calculated_payout_amount_in_usd,
|
||||
calculated_guest_charge_amount_in_txn_currency,
|
||||
calculated_guest_charge_currency,
|
||||
calculated_guest_charge_amount_in_usd
|
||||
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_guest_charge_amount_in_txn_currency,
|
||||
i.calculated_guest_charge_currency,
|
||||
i.calculated_guest_charge_amount_in_usd,
|
||||
|
||||
-- Host Details
|
||||
id_user_host,
|
||||
i.id_user_host,
|
||||
lt.claims_count,
|
||||
host_account_name,
|
||||
i.host_account_name,
|
||||
|
||||
-- Host Contact Details
|
||||
host_email,
|
||||
host_last_name,
|
||||
host_first_name,
|
||||
host_phone_code,
|
||||
host_phone_number,
|
||||
i.host_email,
|
||||
i.host_last_name,
|
||||
i.host_first_name,
|
||||
i.host_phone_code,
|
||||
i.host_phone_number,
|
||||
|
||||
-- Guest Details
|
||||
id_user_guest,
|
||||
guest_email,
|
||||
guest_last_name,
|
||||
guest_first_name,
|
||||
guest_phone_code,
|
||||
guest_phone_number,
|
||||
i.id_user_guest,
|
||||
i.guest_email,
|
||||
i.guest_last_name,
|
||||
i.guest_first_name,
|
||||
i.guest_phone_code,
|
||||
i.guest_phone_number,
|
||||
|
||||
-- Guest Deposit Details
|
||||
is_guest_deposit_retained,
|
||||
is_guest_deposit_collected,
|
||||
deposit_retained_amount_in_txn_currency,
|
||||
deposit_retained_currency,
|
||||
i.is_guest_deposit_retained,
|
||||
i.is_guest_deposit_collected,
|
||||
i.deposit_retained_amount_in_txn_currency,
|
||||
i.deposit_retained_currency,
|
||||
|
||||
-- Guest Involvements
|
||||
has_guest_contributed_to_cost,
|
||||
has_host_taken_preventative_steps,
|
||||
guest_contribution_amount_in_txn_currency,
|
||||
guest_contribution_currency,
|
||||
guest_contacted_about_damage,
|
||||
i.has_guest_contributed_to_cost,
|
||||
i.has_host_taken_preventative_steps,
|
||||
i.guest_contribution_amount_in_txn_currency,
|
||||
i.guest_contribution_currency,
|
||||
i.guest_contacted_about_damage,
|
||||
|
||||
-- Accommodation Details
|
||||
id_accommodation,
|
||||
accommodation_name,
|
||||
i.id_accommodation,
|
||||
i.accommodation_name,
|
||||
|
||||
-- Booking Details
|
||||
check_in_at_utc,
|
||||
check_in_date_utc,
|
||||
check_out_at_utc,
|
||||
check_out_date_utc,
|
||||
id_booking,
|
||||
booking_status,
|
||||
id_reservation,
|
||||
booking_protection
|
||||
i.check_in_at_utc,
|
||||
i.check_in_date_utc,
|
||||
i.check_out_at_utc,
|
||||
i.check_out_date_utc,
|
||||
i.id_booking,
|
||||
i.booking_status,
|
||||
i.id_reservation,
|
||||
i.booking_protection
|
||||
|
||||
from stg_resolutions__incidents i
|
||||
left join logs_timeline lt on i.id_incident = lt.id_incident
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue