false zero price bugfix
All checks were successful
/ Make image (push) Successful in 1m3s

This commit is contained in:
nquidox 2025-12-07 13:37:15 +03:00
parent 4c59ab3f58
commit 8f2b0470b1

View file

@ -339,8 +339,8 @@ func (r *Repo) getZeroPrices(userUuid string) ([]ZeroPrice, error) {
WITH price_with_neighbors AS ( WITH price_with_neighbors AS (
SELECT SELECT
p.id, p.created_at, p.merch_uuid, p.price, p.origin, m.name, p.id, p.created_at, p.merch_uuid, p.price, p.origin, m.name,
LAG(price) OVER (PARTITION BY p.merch_uuid ORDER BY p.created_at, p.id) AS prev_price, LAG(price) OVER (PARTITION BY p.merch_uuid, p.origin ORDER BY p.created_at, p.id) AS prev_price,
LEAD(price) OVER (PARTITION BY p.merch_uuid ORDER BY p.created_at, p.id) AS next_price LEAD(price) OVER (PARTITION BY p.merch_uuid, p.origin ORDER BY p.created_at, p.id) AS next_price
FROM prices AS p FROM prices AS p
JOIN merch as m ON m.merch_uuid = p.merch_uuid JOIN merch as m ON m.merch_uuid = p.merch_uuid
WHERE p.deleted_at IS NULL WHERE p.deleted_at IS NULL