Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 0d43f7f

Browse files
♻️ Add brand-based discount
1 parent 3d239ec commit 0d43f7f

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

src/fill.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,58 @@ export const getDataFromPfister = async (url: string) => {
164164
const value = $(elt).find("td").text();
165165
specifications[key] = value;
166166
});
167+
const noDiscountBrands = [
168+
"Mobitare",
169+
"Intertime",
170+
"Brühl",
171+
"Stressless",
172+
"Leolux",
173+
"Swiss Plus",
174+
"Kartell",
175+
"Seetal",
176+
"Willisau",
177+
"Team 7",
178+
"Bico",
179+
"Carpe Diem",
180+
"Superba",
181+
"Jensen",
182+
"Riposa",
183+
"Riposa Gold",
184+
"Gloster",
185+
"Glatz",
186+
"Gastro",
187+
"Pendalex",
188+
"Moll",
189+
"Jan Kath",
190+
"Bonaldo",
191+
"Freistil",
192+
"Sitzplatz",
193+
"Strässle",
194+
"Glatz",
195+
"Girsberger",
196+
"MAB Betschart",
197+
"Hülsta",
198+
"Ronald Schmitt",
199+
"Schaffner",
200+
"Artanova",
201+
"Naos",
202+
"Jori",
203+
"Spectral",
204+
"Himolla",
205+
"Natuzzi",
206+
"KFF",
207+
"BOSSE",
208+
"GIROFLEX ",
209+
"RUF",
210+
"Sjöholm",
211+
"TRINATURA",
212+
];
213+
const brand = specifications.Marken;
214+
let hasDiscount = true;
215+
noDiscountBrands.forEach((name) => {
216+
if (brand.includes(name)) hasDiscount = false;
217+
});
218+
const discountedPrice = hasDiscount ? salePrice * 0.85 : salePrice;
167219
let deliveryTime = $("header + div[type=button]")
168220
.text()
169221
.replace("Lieferzeit: ", "")
@@ -186,6 +238,7 @@ export const getDataFromPfister = async (url: string) => {
186238
title,
187239
fullPrice,
188240
salePrice,
241+
discountedPrice,
189242
description,
190243
specifications,
191244
deliveryTime,

0 commit comments

Comments
 (0)