Repository navigation
[2.2.24] - 2026-11-28
The product sheet can prove the barcode it stores — and remembers the answer
Asked for: «per ogni articolo quando apro la scheda mi dai anche un bottone verifica/aggiorna
barcode che mi faccia scansionare il barcode che mi dica se è quello corretto e se non lo è lo
aggiorna? E che si ricordi poi i barcode mi raccomando!». A pantry row points at an ARTICLE
through products.barcode, and a code written once by an import or by a wrong catalogue match
keeps every later scan of that box pointing at the wrong product — with nothing in the UI able
to prove it.
- The product sheet states the code and offers the door.
_itemDetailBarcodeHtml()prints
the stored code (or «Nessun barcode salvato», the case a hand-added article is in) beside a
neutral «📷 Verifica» (_barcodeVerifyStart). A medicine has no door — its number is the AIC
the catalogue verified — and the demo hides it, because the demo refuses writes. - One article, one code, one answer. The scanner reopens on that article alone (a notice
with its name and its stored code, the ordinary action bar hidden, title «Verifica barcode»,
#page-scan.is-barcode-verify) andonBarcodeDetected()hands the read to
_barcodeVerifyHandle(). The SAME code — compared with the GTIN variants the server itself
tries (_barcodeCandidates(), the mirror ofbarcodeLookupCandidates()) — answers «✓ Il
barcode è corretto» and writes nothing; a different one goes throughproduct_barcode_set
(that ONE field, never the whole product) and answers «✓ Barcode aggiornato: old → new»; a
code another article owns is refused by the server and the sheet says whose it is
(barcode_already_used,audit.assign_taken), instead of merging two articles behind a tap.
The typed field in the same notice is the door of a device without a camera. - The device remembers it.
_barcodeApplyNewCode()patches the pantry caches, forgets the
OLD code in the resolve table (_barcodeForgetCode) and records the new one with the article
it belongs to (_barcodeRememberProduct, session + persisted), so the very next scan of that
pack opens this article. The server already storesproducts.barcode, and
product_barcode_setis a_PANTRY_WRITE_ACTIONSentry, so every screen re-reads the rows. - Leaving is not answering. Walking away from the scan page clears the job (
showPage()),
and an answer that arrives afterwards is dropped instead of reopening a sheet the household
closed. The verdict is painted once, in the sheet that earned it. - A
barcodenamespace in the six locales (15 keys),surfaces.cssfor both blocks, code
indexes regenerated.
A recipe moved from the chat to the ricette keeps ITS OWN ingredients — and the chat loses «Usa»
Reported: «Speso quando trasferisco una ricetta dalla chat alle ricette gli ingredienti sono
sbagliati, non corretti, mancano o sono in più. E togli "usa" dalla chat toglilo proprio.»
- The reply is the recipe, not a draft to re-interpret.
chat_to_recipehanded the whole
reply to the model and asked it to rebuild the dish, so the ingredient list was a SECOND
reading of text that already had one: the prompt asked to use "that EXACT pantry name", so
«zucchine» came back as «Zucchine grigliate surgelate», lines the reply did write were dropped,
and quantities were clamped to what the shelf held.recipeParseChatIngredients()now reads
the «Ingredienti» section deterministically — bullets, numbering, bold,Nome: 200 g,
200 g di nome,2 uova,2 fette di pane,½,1/2,80-90 g,q.b., group headings
(Per la pasta:) skipped, the six languages we ship and the inlineIngredienti: a, b, c—
and that list REPLACES the model's insidechatToRecipe(). The model only shapes title,
servings, times and steps (the prompt now carries the fixed list and forbids adding, removing
or renaming anything). - The pantry pass may LINK, never rewrite — on the server and in the browser.
recipePostProcessGenerated()gained three options:preserve_names(keep «Zucchine» instead
of the pantry row's title),clamp_qty(never shrinkqty_numberto the stock) and
keep_unlinked(an ingredient the shelves do not have stays in the recipe instead of being
deleted).recipeChatRestoreQtyText()prints the chat's own wording back (qty_numberstill
carries the amount in the pantry unit, which is what the «Usa» sheet needs) and every row is
markedverbatim:enrichRecipeIngredientsStock()then links it WITHOUT renaming and never
applies the per-serving cap,_normalizeRecipeIngQtyNumber()/_computeRecipeIngStockHint()
leaveqtyalone, andrenderRecipe()PRINTS an unlinked row as a plain line («non in
dispensa») — hiding it was the other half of «mancano» (the sheet used to render only rows with
aproduct_id). The client's_recipeArchiveMissingInfo()keeps judging whether the dish is
cookable, so nothing claims «hai tutti gli ingredienti» on an unlinked row. - The two lists are logged side by side (
chat_to_recipe_okwithfrom_text/from_ai/
kept), so the next «gli ingredienti sono sbagliati» is checked inlogs/instead of guessed. - The chat has no «Usa» strip any more (asked for twice):
formatChatReply()only formats
the markdown, and the one door a recipe reply keeps is «📥 Trasferisci alle ricette». The
builder (_chatUseActionsHtml), its matching helpers (_chatIngredientBlocks/_chatIsLabel/
_chatMatchProductsInText/_chatProductNeedles/_chatInventoryForMatching), the unused
loadChatContext()/chatInventoryContextand the.chat-use-*CSS are removed, not parked.