fix
Some checks failed
CI and deploy / migration-check (push) Failing after 18s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-27 18:48:04 +02:00
parent e96bb75b87
commit 30585c9779
4 changed files with 89 additions and 11 deletions

View File

@@ -0,0 +1,28 @@
create or replace function ems.fn_site_effective_prices_slots_range(
p_site_id int,
p_from timestamptz,
p_to timestamptz
)
returns jsonb
language sql
stable
as $fn$
select coalesce(
jsonb_agg(u.j order by u.interval_start),
'[]'::jsonb
)
from (
select
v.interval_start,
to_jsonb(v) as j
from ems.vw_site_effective_price v
where v.site_id = p_site_id
and v.interval_start >= p_from
and v.interval_end < p_to
order by v.interval_start
) u;
$fn$;
comment on function ems.fn_site_effective_prices_slots_range(int, timestamptz, timestamptz) is
'Efektivní ceny pro [p_from, p_to) jako pole JSON řádků view (range pro UI bez PostgREST auth).';