mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-23 17:05:53 +02:00
Add bio-cart to patterns and site...
This commit is contained in:
parent
496a40d852
commit
c569d8b3a7
29
patterns.js
29
patterns.js
|
@ -54,7 +54,7 @@ if (!fs.existsSync("patterns/sorted-billa-spar.json")) {
|
|||
analysis.writeJSON("patterns/sorted-billa-spar.json", sortedItems);
|
||||
}
|
||||
|
||||
{
|
||||
if (!fs.existsSync("site/data/billa-spar-cart.json")) {
|
||||
const sortedItems = analysis.readJSON("patterns/sorted-billa-spar.json");
|
||||
const filteredItems = filterSimilarItems(sortedItems);
|
||||
analysis.writeJSON("site/data/billa-spar-cart.json", {
|
||||
|
@ -79,7 +79,7 @@ if (!fs.existsSync("patterns/sorted-budget.json")) {
|
|||
analysis.writeJSON("patterns/sorted-budget.json", sortedItems);
|
||||
}
|
||||
|
||||
{
|
||||
if (!fs.existsSync("site/data/budget-cart.json")) {
|
||||
const sortedItems = analysis.readJSON("patterns/sorted-budget.json");
|
||||
const filteredItems = filterSimilarItems(sortedItems);
|
||||
analysis.writeJSON("site/data/budget-cart.json", {
|
||||
|
@ -89,3 +89,28 @@ if (!fs.existsSync("patterns/sorted-budget.json")) {
|
|||
}),
|
||||
});
|
||||
}
|
||||
|
||||
if (!fs.existsSync("patterns/sorted-bio.json")) {
|
||||
const items = analysis.readJSON("data/latest-canonical.json.br");
|
||||
const sortedItems = similaritySort(
|
||||
items,
|
||||
(item) => {
|
||||
if (!(item.store == "billa" || item.store == "spar")) return false;
|
||||
return ["Ja! Natürlich", "SPAR Natur*pur"].some((str) => item.name.includes(str));
|
||||
},
|
||||
(item) => item.store === "billa",
|
||||
(item) => item.store === "spar"
|
||||
);
|
||||
analysis.writeJSON("patterns/sorted-bio.json", sortedItems);
|
||||
}
|
||||
|
||||
if (!fs.existsSync("site/data/bio-cart.json")) {
|
||||
const sortedItems = analysis.readJSON("patterns/sorted-bio.json");
|
||||
const filteredItems = filterSimilarItems(sortedItems);
|
||||
analysis.writeJSON("site/data/bio-cart.json", {
|
||||
name: "Bio Eigenmarken Produkte Billa/Spar",
|
||||
items: filteredItems.map((item) => {
|
||||
return { store: item.store, id: item.id };
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
|
13510
site/data/bio-cart.json
Normal file
13510
site/data/bio-cart.json
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,11 @@ class Carts extends Model {
|
|||
carts.unshift(budgetCart);
|
||||
}
|
||||
|
||||
if (!carts.some((cart) => cart.name == "Bio Eigenmarken Produkte Billa/Spar")) {
|
||||
const budgetCart = await misc.fetchJSON("data/bio-cart.json");
|
||||
carts.unshift(budgetCart);
|
||||
}
|
||||
|
||||
// Update items in cart to their latest version.
|
||||
for (const cart of carts) {
|
||||
const items = [];
|
||||
|
|
Loading…
Reference in New Issue
Block a user