Fix loading of carts, only add items for which lookup succeeds.

This commit is contained in:
Mario Zechner 2023-06-28 11:15:34 +02:00
parent bb11db1520
commit f5998383f5
2 changed files with 20 additions and 21 deletions

View File

@ -55,8 +55,7 @@ class Carts extends Model {
const items = []; const items = [];
for (const cartItem of cart.items) { for (const cartItem of cart.items) {
const item = itemsLookup[cartItem.store + cartItem.id]; const item = itemsLookup[cartItem.store + cartItem.id];
if (!item) items.push(cartItem); if (item) items.push(item);
else items.push(item);
} }
cart.items = items; cart.items = items;
} }

View File

@ -399,13 +399,13 @@
"code": "34" "code": "34"
}, },
{ {
"id": "joghurt-topfen", "id": "milch-sahne-butter",
"url": "https://www.roksh.at/hofer/angebot/joghurt-topfen", "url": "https://www.roksh.at/hofer/angebot/milch-sahne-butter",
"code": "34" "code": "34"
}, },
{ {
"id": "milch-sahne-butter", "id": "joghurt-topfen",
"url": "https://www.roksh.at/hofer/angebot/milch-sahne-butter", "url": "https://www.roksh.at/hofer/angebot/joghurt-topfen",
"code": "34" "code": "34"
}, },
{ {
@ -484,13 +484,13 @@
"code": "32" "code": "32"
}, },
{ {
"id": "rind", "id": "faschiertes",
"url": "https://www.roksh.at/hofer/angebot/rind", "url": "https://www.roksh.at/hofer/angebot/faschiertes",
"code": "32" "code": "32"
}, },
{ {
"id": "faschiertes", "id": "rind",
"url": "https://www.roksh.at/hofer/angebot/faschiertes", "url": "https://www.roksh.at/hofer/angebot/rind",
"code": "32" "code": "32"
}, },
{ {
@ -503,19 +503,14 @@
"url": "https://www.roksh.at/hofer/angebot/honig-nussaufstriche", "url": "https://www.roksh.at/hofer/angebot/honig-nussaufstriche",
"code": "56" "code": "56"
}, },
{
"id": "obstkonserven",
"url": "https://www.roksh.at/hofer/angebot/obstkonserven",
"code": "57"
},
{ {
"id": "gemusekonserven", "id": "gemusekonserven",
"url": "https://www.roksh.at/hofer/angebot/gemusekonserven", "url": "https://www.roksh.at/hofer/angebot/gemusekonserven",
"code": "57" "code": "57"
}, },
{ {
"id": "fleisch-fischkonserven", "id": "obstkonserven",
"url": "https://www.roksh.at/hofer/angebot/fleisch-fischkonserven", "url": "https://www.roksh.at/hofer/angebot/obstkonserven",
"code": "57" "code": "57"
}, },
{ {
@ -523,6 +518,11 @@
"url": "https://www.roksh.at/hofer/angebot/sauerkonserven", "url": "https://www.roksh.at/hofer/angebot/sauerkonserven",
"code": "57" "code": "57"
}, },
{
"id": "fleisch-fischkonserven",
"url": "https://www.roksh.at/hofer/angebot/fleisch-fischkonserven",
"code": "57"
},
{ {
"id": "nusse", "id": "nusse",
"url": "https://www.roksh.at/hofer/angebot/nusse", "url": "https://www.roksh.at/hofer/angebot/nusse",
@ -629,13 +629,13 @@
"code": "20" "code": "20"
}, },
{ {
"id": "smoothies", "id": "sirupe",
"url": "https://www.roksh.at/hofer/angebot/smoothies", "url": "https://www.roksh.at/hofer/angebot/sirupe",
"code": "20" "code": "20"
}, },
{ {
"id": "sirupe", "id": "smoothies",
"url": "https://www.roksh.at/hofer/angebot/sirupe", "url": "https://www.roksh.at/hofer/angebot/smoothies",
"code": "20" "code": "20"
}, },
{ {