Spaces:
Sleeping
Sleeping
Commit ·
f8c345c
1
Parent(s): e433935
hide sold-out products from browse and discover
Browse filesProducts with in_stock=0 are now excluded from both browse
and discover queries. The 4 price=0 products are stale leftovers
from old scrapers — already marked out-of-stock by sync().
backend/app/routers/discover.py
CHANGED
|
@@ -70,7 +70,7 @@ def get_next_products(count: int = 10):
|
|
| 70 |
PARTITION BY brand, name, store ORDER BY score DESC
|
| 71 |
) AS rn
|
| 72 |
FROM products
|
| 73 |
-
WHERE image_url != '' AND score IS NOT NULL AND score > 0
|
| 74 |
) WHERE rn = 1
|
| 75 |
ORDER BY score DESC
|
| 76 |
""").fetchall()
|
|
|
|
| 70 |
PARTITION BY brand, name, store ORDER BY score DESC
|
| 71 |
) AS rn
|
| 72 |
FROM products
|
| 73 |
+
WHERE image_url != '' AND score IS NOT NULL AND score > 0 AND in_stock = 1
|
| 74 |
) WHERE rn = 1
|
| 75 |
ORDER BY score DESC
|
| 76 |
""").fetchall()
|
backend/app/routers/products.py
CHANGED
|
@@ -63,7 +63,7 @@ def list_products(
|
|
| 63 |
)
|
| 64 |
""")
|
| 65 |
|
| 66 |
-
where = ["(score IS NOT NULL AND score >= ?)", "url NOT IN (SELECT url FROM discover_ratings)"]
|
| 67 |
params: list = [min_score]
|
| 68 |
|
| 69 |
if store:
|
|
|
|
| 63 |
)
|
| 64 |
""")
|
| 65 |
|
| 66 |
+
where = ["(score IS NOT NULL AND score >= ?)", "url NOT IN (SELECT url FROM discover_ratings)", "in_stock = 1"]
|
| 67 |
params: list = [min_score]
|
| 68 |
|
| 69 |
if store:
|