From ad595ea8e6a721b7c86a3a2d375bdb7a2fdf5a55 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 21 Jul 2024 12:27:04 +0200 Subject: [PATCH] fix bug crashed if user got already third voucher code --- .../groups/shx-all-in-one-order/index.json | 4 +++- .../shx-intern-product-bag-label/index.json | 4 +++- .../groups/shx-order-voucher-codes/script.py | 10 ++++++---- groupTasks/groups/shx-product-label/index.json | 4 +++- .../groupsData/google-sheet-products.json | 18 ++++++++++++++++-- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/groupTasks/groups/shx-all-in-one-order/index.json b/groupTasks/groups/shx-all-in-one-order/index.json index e8bd742..e60070b 100644 --- a/groupTasks/groups/shx-all-in-one-order/index.json +++ b/groupTasks/groups/shx-all-in-one-order/index.json @@ -79,11 +79,13 @@ "#23732 Witty der Fuchs, STIL, Standard, Mit Halstuch", "#72175 Paco die Bulldogge, FARBE, Grau, ", "#55172 Sharky der Hai, FARBE, Grau, ", + "#65423 Sharky der Hai, FARBE, Blau ➔ Weiß, ", "#10971 Chibi die Ratte, FARBE, Grau, ", "#84712 Personalisiertes Namensschild, TYP, Einfarbig, ", "#17200 Personalisiertes Namensschild, TYP, Zweifarbig, ", "#97548 Personalisiertes Namensschild, TYP, Dreifarbig, ", - "#68859 Personalisiertes Namensschild mit Hintergrund, , , " + "#68859 Personalisiertes Namensschild mit Hintergrund, TYP, Zweifarbig, ", + "#49340 Personalisiertes Namensschild mit Hintergrund, TYP, Dreifarbig, " ] } ] diff --git a/groupTasks/groups/shx-intern-product-bag-label/index.json b/groupTasks/groups/shx-intern-product-bag-label/index.json index ab127ef..7e9f8dc 100644 --- a/groupTasks/groups/shx-intern-product-bag-label/index.json +++ b/groupTasks/groups/shx-intern-product-bag-label/index.json @@ -59,11 +59,13 @@ "#23732 Witty der Fuchs, STIL, Standard, Mit Halstuch", "#72175 Paco die Bulldogge, FARBE, Grau, ", "#55172 Sharky der Hai, FARBE, Grau, ", + "#65423 Sharky der Hai, FARBE, Blau ➔ Weiß, ", "#10971 Chibi die Ratte, FARBE, Grau, ", "#84712 Personalisiertes Namensschild, TYP, Einfarbig, ", "#17200 Personalisiertes Namensschild, TYP, Zweifarbig, ", "#97548 Personalisiertes Namensschild, TYP, Dreifarbig, ", - "#68859 Personalisiertes Namensschild mit Hintergrund, , , " + "#68859 Personalisiertes Namensschild mit Hintergrund, TYP, Zweifarbig, ", + "#49340 Personalisiertes Namensschild mit Hintergrund, TYP, Dreifarbig, " ] } ] diff --git a/groupTasks/groups/shx-order-voucher-codes/script.py b/groupTasks/groups/shx-order-voucher-codes/script.py index f69327a..f4a0156 100644 --- a/groupTasks/groups/shx-order-voucher-codes/script.py +++ b/groupTasks/groups/shx-order-voucher-codes/script.py @@ -115,7 +115,7 @@ def CheckIfCrmCustomerExists(): show_third_voucher(thirdVoucher) CreateCrmActivityLink(customerId=customerId, thirdVoucher=thirdVoucher) - GetCustomerActivityLinks(customerId=customerId) + GetCustomerActivityLinks(customerId=customerId, thirdVoucher=thirdVoucher) # create shopify discount code @@ -189,7 +189,7 @@ def CreateCrmActivityLink(customerId, thirdVoucher): req("10 € Gutschein", f"https://docs.google.com/forms/d/e/1FAIpQLSd2GXFbidzazuQnh_Lf2mgeA1npuwHkWjsdmjrxDmSkDQTfew/viewform?entry.347359844={orderId}") -def GetCustomerActivityLinks(customerId): +def GetCustomerActivityLinks(customerId, thirdVoucher): response = requests.get( url=f"{ENDPOINT_URL}/customer/view/{customerId}", headers=headers, @@ -225,14 +225,16 @@ def GetCustomerActivityLinks(customerId): elif linkGift10Percent is None and link["Name"].startswith(f"Shopify Order #{orderId} - 10 % Gutschein"): linkGift10Percent = link - if linkGift5 is None or linkGift10 is None or linkGift10Percent is None: + if linkGift5 is None or linkGift10Percent is None: print("Gift links not found") sys.exit(1) utils.create_qrcode(f"{QR_CODE_URL}{linkGift5['Id']}", "./5euro.png", "#fdf8ef") - utils.create_qrcode(f"{QR_CODE_URL}{linkGift10['Id']}", "./10euro.png", "#fdf8ef") utils.create_qrcode(f"{QR_CODE_URL}{linkGift10Percent['Id']}", "./10percent.png", "#fdf8ef") + if thirdVoucher: + utils.create_qrcode(f"{QR_CODE_URL}{linkGift10['Id']}", "./10euro.png", "#fdf8ef") + def ReplaceHtmlVariables(): print("ReplaceHtmlVariables") diff --git a/groupTasks/groups/shx-product-label/index.json b/groupTasks/groups/shx-product-label/index.json index 1904b32..d83a127 100644 --- a/groupTasks/groups/shx-product-label/index.json +++ b/groupTasks/groups/shx-product-label/index.json @@ -63,11 +63,13 @@ "#23732 Witty der Fuchs, STIL, Standard, Mit Halstuch", "#72175 Paco die Bulldogge, FARBE, Grau, ", "#55172 Sharky der Hai, FARBE, Grau, ", + "#65423 Sharky der Hai, FARBE, Blau ➔ Weiß, ", "#10971 Chibi die Ratte, FARBE, Grau, ", "#84712 Personalisiertes Namensschild, TYP, Einfarbig, ", "#17200 Personalisiertes Namensschild, TYP, Zweifarbig, ", "#97548 Personalisiertes Namensschild, TYP, Dreifarbig, ", - "#68859 Personalisiertes Namensschild mit Hintergrund, , , " + "#68859 Personalisiertes Namensschild mit Hintergrund, TYP, Zweifarbig, ", + "#49340 Personalisiertes Namensschild mit Hintergrund, TYP, Dreifarbig, " ], "global": false } diff --git a/groupTasks/groupsData/google-sheet-products.json b/groupTasks/groupsData/google-sheet-products.json index e49ead8..c818654 100644 --- a/groupTasks/groupsData/google-sheet-products.json +++ b/groupTasks/groupsData/google-sheet-products.json @@ -301,6 +301,13 @@ "product_characteristic_line_1": "Grau", "product_characteristic_line_2": "" }, + { + "id": "65423", + "name": "Sharky_der Hai", + "product_variant": "FARBE", + "product_characteristic_line_1": "Blau ➔ Weiß", + "product_characteristic_line_2": "" + }, { "id": "10971", "name": "Chibi_die Ratte", @@ -332,8 +339,15 @@ { "id": "68859", "name": "Personalisiertes_Namensschild mit Hintergrund", - "product_variant": "", - "product_characteristic_line_1": "", + "product_variant": "TYP", + "product_characteristic_line_1": "Zweifarbig", + "product_characteristic_line_2": "" + }, + { + "id": "49340", + "name": "Personalisiertes_Namensschild mit Hintergrund", + "product_variant": "TYP", + "product_characteristic_line_1": "Dreifarbig", "product_characteristic_line_2": "" } ]