From 422479c723a1df098f5bb9e6a35d1b867a4a9b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pol=20Mons=C3=B3=20Purt=C3=AD?= Date: Wed, 21 Feb 2024 13:12:42 +0100 Subject: [PATCH] Resolve "Plants overview now - Energia Perduda dia anterior" (et/somenergia-jardiner!118) * add interval type cast * filter out energia perduda older than yesterday on overview --- .../models/jardiner/marts/dm_dashboard_overview_instant.sql | 4 ++++ superset/produccio_davui.yml | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dbt_jardiner/models/jardiner/marts/dm_dashboard_overview_instant.sql b/dbt_jardiner/models/jardiner/marts/dm_dashboard_overview_instant.sql index 194c6c59..43917e62 100644 --- a/dbt_jardiner/models/jardiner/marts/dm_dashboard_overview_instant.sql +++ b/dbt_jardiner/models/jardiner/marts/dm_dashboard_overview_instant.sql @@ -12,5 +12,9 @@ select round(overview.instant_power_plant_kw, 2) as potencia_inst_kw, round(overview.instant_power_plant_kw / overview.nominal_power_kw, 2) as potencia_inst_vs_nominal, overview.day as dia, + case + when overview.day > now() - interval '2 days' then + round((overview.meter_exported_energy_kwh - overview.solargis_meter_expected_energy_kwh) / 1000, 2) + end as energia_perduda_ahir_mwh, round((overview.meter_exported_energy_kwh - overview.solargis_meter_expected_energy_kwh) / 1000, 2) as energia_perduda_mwh from {{ ref("int_plants_overview_instant") }} as overview diff --git a/superset/produccio_davui.yml b/superset/produccio_davui.yml index 6c3bf4ec..09b474f4 100644 --- a/superset/produccio_davui.yml +++ b/superset/produccio_davui.yml @@ -12,8 +12,7 @@ html: > Potència instantània temps de lectura Potència instantània [kW] Potència instantània vs nominal [%] - Dia - Energia Perduda [MWh]
dia anterior + Energia Perduda Ahir [MWh] @@ -29,8 +28,7 @@ html: > {{ potencia_inst_ts }} {{ potencia_inst_kw }} {{#if potencia_inst_vs_nominal}} {{ potencia_inst_vs_nominal }}% {{/if}} - {{ dateFormat dia }} - {{ energia_perduda_mwh }} + {{ energia_perduda_ahir_mwh }} {{/each}}