tests found

This commit is contained in:
2026-04-15 14:07:39 +03:00
parent ade4071eb8
commit 2e0b71cf3f
11 changed files with 69 additions and 111 deletions
+10 -11
View File
@@ -60,15 +60,15 @@ WITH
AND siv."__deletedAt" IS NULL
and d."__deletedAt" IS NULL
and a."__deletedAt" IS NULL
and a.is_actual
--and a.is_actual
and siv.type IN (2,3)
),
component as
(
SELECT
price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost ,
price ,
cnt ,
-- price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost ,
-- price ,
cnt ,
code ,
__id
FROM
@@ -93,8 +93,7 @@ WITH
) t
WHERE
t.dt_from = t.running_min_dt
AND t.dt_to > CURRENT_TIMESTAMP
OR t.dt_to IS NULL
AND ( t.dt_to > CURRENT_TIMESTAMP OR t.dt_to IS NULL )
),
alloc as
(
@@ -129,7 +128,7 @@ WITH
z.__id as company_uid,
round(sum(c.cnt*o.cnt)) as quantity ,
count(*) as lines ,
STRING_AGG( distinct c.code,', ' order by c.code) as codes
STRING_AGG(distinct c.code,', ' order by c.code) as codes
FROM
stair o
JOIN elma.companies z on o._companies=z.__id
@@ -153,7 +152,7 @@ WITH
z.__id as company_uid,
round(sum(c.cnt*o.cnt)) as quantity ,
count(*) as lines ,
STRING_AGG(c.code,', ' order by c.code) as codes
STRING_AGG(distinct c.code,', ' order by c.code) as codes
FROM
stair o
JOIN
@@ -161,8 +160,8 @@ WITH
LEFT JOIN component c on c.__id = o.param_id
--LEFT JOIN component c on (c.__id = ANY (o.params))
WHERE
c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
--(c.code LIKE 'iaas.ngc.%.vcpu%-_' OR c.code LIKE 'iaas.dcp.%.vcpu%-_')
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
(c.code LIKE 'iaas.ngc.%.vcpu%-_' OR c.code LIKE 'iaas.dcp.%.vcpu%-_')
AND c.cnt <> 0
AND o.cnt <> 0
GROUP BY
@@ -178,7 +177,7 @@ WITH
z.__id as company_uid,
round(sum(c.cnt*o.cnt)) as quantity ,
count(*) as lines ,
STRING_AGG(c.code,', ' order by c.code) as codes
STRING_AGG(distinct c.code,', ' order by c.code) as codes
FROM
stair o
JOIN elma.companies z on (o._companies=z.__id)