Skip to content

Commit

Permalink
Merge pull request #2 from pedro-mealha/parse-products
Browse files Browse the repository at this point in the history
filter products
  • Loading branch information
pedro-mealha authored Mar 20, 2024
2 parents 303d6fe + 6184fdd commit 4163a6f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let newCsvData;
window.onload = () => {
const oldCsvInput = document.createElement('input');
oldCsvInput.type = 'file';
oldCsvInput.accept = '.csv';

const newCsvInput = document.createElement('input');
newCsvInput.type = 'file';
Expand Down Expand Up @@ -95,13 +96,14 @@ window.onload = () => {
}

for (const row of newCsvData) {
if (row[PRODUCT_PRICING_OPTION_INDEX] === EXCHANGE_PRICE) {
const { id, index } = getProductBasicDetails(row);

if (!id || row[PRODUCT_PRICING_OPTION_INDEX] === EXCHANGE_PRICE) {
continue;
}

const { id, index } = getProductBasicDetails(row);

if (!id) {
if (products[index].oldPrice === row[PRODUCT_PRICE_INDEX]) {
delete products[index];
continue;
}

Expand Down

0 comments on commit 4163a6f

Please sign in to comment.