From c9f053e56c986521cce73a673875cbd6a29b59fb Mon Sep 17 00:00:00 2001 From: YNWA Fawzy <38886749+Cybrarist@users.noreply.github.com> Date: Wed, 15 Jan 2025 02:08:30 -0800 Subject: [PATCH] - fix error when no rate is available for product on amazon - fix amazon products don't submit due to change in ratings format --- Product.js | 2 +- Stores/Amazon.js | 1 - Stores/Argos.js | 3 ++- Stores/Ebay.js | 5 ++--- Stores/Noon.js | 5 ++++- functions.js | 8 +------- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Product.js b/Product.js index a51e1b7..2a0a63e 100644 --- a/Product.js +++ b/Product.js @@ -111,7 +111,7 @@ class Product { favourite: document.getElementById("favourite").checked, stock_available: document.getElementById("stock_available").checked, lowest_within: document.getElementById("lowest_within").value, - number_of_rates:this.number_of_rates, + number_of_rates:this.number_of_rates ?? 0, price:this?.price ?? 0, }) }) diff --git a/Stores/Amazon.js b/Stores/Amazon.js index 64d4c61..0e0b517 100644 --- a/Stores/Amazon.js +++ b/Stores/Amazon.js @@ -16,7 +16,6 @@ class Amazon extends Product { .replaceAll("(" , "") .replaceAll(")" , "") - console.log(this.number_of_rates) } diff --git a/Stores/Argos.js b/Stores/Argos.js index af9039a..f9308d1 100644 --- a/Stores/Argos.js +++ b/Stores/Argos.js @@ -61,7 +61,8 @@ if (window.location.href.includes('argos.co.uk') ){ ) setTimeout(() => { - + if (!data) + return; insert_chart_into_dom(data.series) var stores_elements=document.getElementById("all_stores_cards"); diff --git a/Stores/Ebay.js b/Stores/Ebay.js index d67ba50..b9aab88 100644 --- a/Stores/Ebay.js +++ b/Stores/Ebay.js @@ -31,9 +31,8 @@ if (window.location.href.includes('ebay.') ){ async get_product_data() { super.get_product_data().then(data => { - - - console.log(data) + if (!data) + return; insert_chart_into_dom(data.series) //add highest and lowest prices diff --git a/Stores/Noon.js b/Stores/Noon.js index 0d82202..58ab64c 100644 --- a/Stores/Noon.js +++ b/Stores/Noon.js @@ -37,7 +37,10 @@ class Noon extends Product { super.get_product_data().then(data => { // - insert_chart_into_dom(data.series) + if (!data) + return; + + insert_chart_into_dom(data.series) //add highest and lowest prices document.querySelector(".priceNow[data-qa='div-price-now']").insertAdjacentHTML("beforebegin" , `
Lowest Price ${data.prices[data.current_store_id].lowest_price.toLocaleString()}
diff --git a/functions.js b/functions.js index f7fc983..53aaba7 100644 --- a/functions.js +++ b/functions.js @@ -108,8 +108,6 @@ function insert_chart_into_dom(series){ function get_global_form(){ - console.log(product) - return`
@@ -137,11 +135,7 @@ function get_global_form(){
-` - - - -} +`}