Compare commits

..

No commits in common. "main" and "v0.1.24" have entirely different histories.

View file

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