groceries: add PLUS, Xenos and Amazing Oriental stores, is_food flag, PLUS EAN backfill
All checks were successful
Deploy production / deploy (push) Successful in 1m7s
All checks were successful
Deploy production / deploy (push) Successful in 1m7s
This commit is contained in:
@@ -73,6 +73,8 @@ export const load: PageServerLoad = async (event) => {
|
||||
const favorites = p.get('fav') === '1';
|
||||
const promo = p.get('promo') === '1';
|
||||
const multi = p.get('multi') === '1';
|
||||
// Homeware (Xenos décor, woks, …) is hidden unless asked for; drugstore/household stay.
|
||||
const nonfood = p.get('nonfood') === '1';
|
||||
const page = Math.max(1, Math.min(10_000, Number(p.get('page')) || 1));
|
||||
const detailId = Number(p.get('g')) || null;
|
||||
|
||||
@@ -92,6 +94,7 @@ export const load: PageServerLoad = async (event) => {
|
||||
if (favorites) conds.push(s`g.favorite`);
|
||||
if (promo) conds.push(s`g.promo_count > 0`);
|
||||
if (multi) conds.push(s`g.store_count >= 2`);
|
||||
if (!nonfood) conds.push(s`(g.is_food or g.category is distinct from 'Overig')`);
|
||||
const where = conds.reduce((a, c) => s`${a} and ${c}`);
|
||||
const order = q
|
||||
? s`g.favorite desc, (lower(g.name) = ${q}) desc, public.word_similarity(${q}::text, lower(g.name)) desc, g.store_count desc, g.item_count desc, g.name`
|
||||
@@ -187,7 +190,15 @@ export const load: PageServerLoad = async (event) => {
|
||||
total,
|
||||
page,
|
||||
pageSize: PAGE_SIZE,
|
||||
filters: { q: p.get('q') ?? '', store: store?.slug ?? '', category, favorites, promo, multi },
|
||||
filters: {
|
||||
q: p.get('q') ?? '',
|
||||
store: store?.slug ?? '',
|
||||
category,
|
||||
favorites,
|
||||
promo,
|
||||
multi,
|
||||
nonfood
|
||||
},
|
||||
categories: catList,
|
||||
stats,
|
||||
runs,
|
||||
|
||||
@@ -272,6 +272,9 @@
|
||||
<label class="check"
|
||||
><input type="checkbox" name="multi" value="1" checked={data.filters.multi} /> In 2+ stores</label
|
||||
>
|
||||
<label class="check" title="Also show homeware and other non-food (mostly Xenos)"
|
||||
><input type="checkbox" name="nonfood" value="1" checked={data.filters.nonfood} /> Non-food</label
|
||||
>
|
||||
<Button type="submit" variant="outline">Search</Button>
|
||||
<div class="segmented ml-auto" role="group" aria-label="Compare by">
|
||||
<button type="button" aria-pressed={mode === 'unit'} onclick={() => (mode = 'unit')}
|
||||
|
||||
Reference in New Issue
Block a user