fix image saving + new icon
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Has been cancelled
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Has been cancelled
This commit is contained in:
@@ -469,6 +469,7 @@ RETURNS TABLE (
|
||||
best_price_in_cents INTEGER,
|
||||
store_name TEXT,
|
||||
flyer_id BIGINT,
|
||||
flyer_icon_url TEXT,
|
||||
flyer_image_url TEXT,
|
||||
flyer_valid_from DATE,
|
||||
flyer_valid_to DATE
|
||||
@@ -487,6 +488,7 @@ BEGIN
|
||||
s.name AS store_name,
|
||||
f.flyer_id AS flyer_id,
|
||||
f.image_url AS flyer_image_url,
|
||||
f.icon_url AS flyer_icon_url,
|
||||
f.valid_from AS flyer_valid_from,
|
||||
f.valid_to AS flyer_valid_to,
|
||||
-- We use ROW_NUMBER to rank sales for the same item, prioritizing the lowest price.
|
||||
@@ -503,7 +505,7 @@ BEGIN
|
||||
AND fi.price_in_cents IS NOT NULL
|
||||
)
|
||||
-- The final select returns only the top-ranked sale (rn = 1) for each item.
|
||||
SELECT uws.master_item_id, uws.item_name, uws.price_in_cents, uws.store_name, uws.flyer_id, uws.flyer_image_url, uws.flyer_valid_from, uws.flyer_valid_to
|
||||
SELECT uws.master_item_id, uws.item_name, uws.price_in_cents, uws.store_name, uws.flyer_id, uws.flyer_icon_url, uws.flyer_image_url, uws.flyer_valid_from, uws.flyer_valid_to
|
||||
FROM UserWatchedSales uws
|
||||
WHERE uws.rn = 1;
|
||||
END;
|
||||
|
||||
Reference in New Issue
Block a user