You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix all cook/deduction endpoints: use canonical alias matching everywhere
Replaced SQL LIKE pattern matching with isIngredientInInventory() in:
- POST /api/recipes/cook (direct cook from Recipes page)
- PUT /api/calendar/:id/cook (cook from Calendar)
- POST /api/cook/check-opened (opened items check)
This ensures renamed inventory items and generic_name matches work
correctly during deduction, same as recipe ingredient display.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
constrows=db.prepare(`SELECT * FROM items WHERE LOWER(name) LIKE LOWER(?) ESCAPE '\\' OR LOWER(?) LIKE LOWER('%' || name || '%') ORDER BY is_open DESC, expiry_date ASC`).all(`%${escapeLike(ing.name)}%`,ing.name)asany[];
1057
+
// Use canonical alias matching
1058
+
constallInv=db.prepare('SELECT * FROM items ORDER BY is_open DESC, expiry_date ASC').all()asany[];
constrows=db.prepare(`SELECT * FROM items WHERE (LOWER(name) LIKE LOWER(?) ESCAPE '\\' OR LOWER(?) LIKE LOWER('%' || name || '%')) AND quantity > 0 ORDER BY is_open DESC, expiry_date ASC`).all(`%${escapeLike(ing.name)}%`,ing.name)asany[];
1376
-
1377
+
// Use canonical alias matching (same as recipe ingredient checking)
1378
+
constallInvItems=db.prepare('SELECT * FROM items WHERE quantity > 0 ORDER BY is_open DESC, expiry_date ASC').all()asany[];
0 commit comments