a dalsi oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 24s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-30 22:02:02 +02:00
parent d3e9caf0fb
commit 5208e035a4
4 changed files with 47 additions and 9 deletions

View File

@@ -1002,6 +1002,21 @@ begin
where wk.sell_price < 0
and wk.pv_surplus_w > 0;
-- v45: v sell<0 okně neg dne — grid nabíjení při kladném buy (prep), i bez pv_surplus (ranní 07:45).
if v_first_neg_sell_ord is not null and v_first_neg_prague_date is not null then
update _ems_plan_slot_wk wk
set allow_charge = true,
allow_grid_charge = true,
grid_charge_suppressed_reason = coalesce(
wk.grid_charge_suppressed_reason,
'neg_window_grid_charge'
)
where wk.slot_ord >= v_first_neg_sell_ord
and wk.sell_price < 0
and wk.buy_price >= 0
and (wk.interval_start at time zone 'Europe/Prague')::date = v_first_neg_prague_date;
end if;
-- Acquisition: grid nabíjení před prvním exportem ve STEJNÝ den jako záporné výkupní okno
-- (ne dřívější večerní export v horizontu rolling replanu).
select min(wk.interval_start)