commit wip

This commit is contained in:
Joaquin Ossa 2025-02-24 16:50:18 +01:00
parent 335fccd57e
commit daa93c056c

View file

@ -2,6 +2,9 @@ with
stg_resolutions__incidents as (
select * from {{ ref("stg_resolutions__incidents") }}
),
int_daily_currency_exchange_rates as (
select * from {{ ref("int_daily_currency_exchange_rates") }}
),
logs_timeline as (
select
id_incident,
@ -35,7 +38,7 @@ with
from stg_resolutions__incidents
),
damage_reported_items as (
select id_incident, jsonb_array_elements(damage_report_items::jsonb) as item -- No need for 'Items' if already an array
select id_incident, jsonb_array_elements(damage_report_items::jsonb) as item,
from stg_resolutions__incidents
where damage_report_items is not null
),
@ -53,6 +56,7 @@ with
coalesce((cm.corrective_measure ->> 'SettlementAmount')::numeric, 0)
) as accepted_amount_in_txn_currency
from damage_reported_items dri
left join int_daily_currency_exchange_rates cer
left join
lateral jsonb_array_elements(
case