SPB Git forge

spb/food-ka

Public

Food-Ka — agrégateur de produits d'épicerie du Québec — www.food-ka.com

55commits 1branches 0releases
10.2 MBsize
maindefault branch
9 days agolast push
Python 53.9% TypeScript 24% CSS 14.9% JavaScript 5.8% HTML 1.4%

tri par défaut : nouveautés (first_seen DESC) au lieu du prix croissant

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Simon-Pierre Boucher committed 1 mo ago (Aug 22, 2026) parent 83a65b8

2 changed files +3 −3

modified foodka/web.py +2 −2
@@ -60,7 +60,7 @@ def list_products(
60 60 on_sale: int | None = None, # 1 = en solde seulement
61 61 in_stock: int | None = None, # 1 / 0
62 62 q: str | None = None,
63 − sort: str = "price_asc",
63 + sort: str = "recent",
64 64 active: int = 1,
65 65 limit: int = Query(60, le=500),
66 66 offset: int = 0,
@@ -88,7 +88,7 @@ def list_products(
88 88 sql += " AND (name LIKE ? OR brand LIKE ? OR category_raw LIKE ?)"
89 89 args += [f"%{q}%"] * 3
90 90 total = con.execute(f"SELECT COUNT(*) c FROM ({sql})", args).fetchone()["c"]
91 − sql += f" ORDER BY {_SORTS.get(sort, _SORTS['price_asc'])} LIMIT ? OFFSET ?"
91 + sql += f" ORDER BY {_SORTS.get(sort, _SORTS['recent'])} LIMIT ? OFFSET ?"
92 92 args += [limit, offset]
93 93 rows = [_row_to_dict(r) for r in con.execute(sql, args).fetchall()]
94 94 con.close()
modified frontend/src/pages/Home.tsx +1 −1
@@ -47,7 +47,7 @@ export default function Home({ aubaines = false }: { aubaines?: boolean }) {
47 47 const [priceMin, setPriceMin] = useState(params.get("price_min") ?? "");
48 48 const [priceMax, setPriceMax] = useState(params.get("price_max") ?? "");
49 49 const [onSale, setOnSale] = useState(aubaines || params.get("on_sale") === "1");
50 − const [sort, setSort] = useState(params.get("sort") ?? (aubaines ? "discount" : "price_asc"));
50 + const [sort, setSort] = useState(params.get("sort") ?? (aubaines ? "discount" : "recent"));
51 51 // feuille de filtres mobile (bottom sheet) + panneau avancé desktop
52 52 const [sheetOpen, setSheetOpen] = useState(false);
53 53 const [advOpen, setAdvOpen] = useState(false);
54 54