diff --git a/apps/api/src/routes/scans.ts b/apps/api/src/routes/scans.ts index c5af145..1c215c3 100644 --- a/apps/api/src/routes/scans.ts +++ b/apps/api/src/routes/scans.ts @@ -221,6 +221,16 @@ export async function scanRoutes(app: FastifyInstance) { }) .returning(); + // Gör den nyss inlagda varan sökbar för resten av SAMMA batch, så att + // två träffar på samma vara i ett och samma foto (t.ex. "helmjölk 4dl" + // + "helmjölk 8dl") slås ihop i stället för att dubbellagras. + activeItems.push({ + id: inv!.id, + canonicalIngredientId: item.canonicalIngredientId ?? null, + displayName: item.displayName, + norm: wantNorm, + }); + await app.db.insert(schema.inventoryTransactions).values({ householdId, inventoryItemId: inv!.id,