Skip to content

Commit

Permalink
fix: fixing tenancy operator to not always go to else
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikZed committed Oct 24, 2024
1 parent a4eba77 commit 2bf363f
Showing 1 changed file with 17 additions and 25 deletions.
42 changes: 17 additions & 25 deletions pkg/integration-kencove-api/src/products/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ export class KencoveApiAppProductSyncService {
this.logger.info(`Found ${products.length} products to sync`);
if (products.length === 0) {
this.logger.info("No products to sync. Exiting.");
await this.cronState.set({ lastRun: new Date() });
// await this.cronState.set({ lastRun: new Date() });
return;
}

Expand Down Expand Up @@ -1672,29 +1672,26 @@ export class KencoveApiAppProductSyncService {
*/
if (
existingProduct.normalizedName !== normalizedProductName ||
existingProduct.name !== product.productName ||
existingProduct.descriptionHTML !== product.description ||
existingProduct.productTypeId !==
kenProdTypeWithProductType.productTypeId ||
existingProduct.countryOfOrigin !== countryOfOrigin ||
category
? existingProduct.categoryId !== category
: false ||
existingProduct.active !== product.active ||
/**
* Compare the media arrays with each other and see, if we have other URLs
*/
!compareArraysWithoutOrder(
existingProduct.media.map((m) => ({
url: m.url,
type: m.type,
})),
this.getTotalMediaFromProduct(product).map(
(m) => ({
url: m.url,
type: m.type,
}),
),
)
(category && existingProduct.categoryId !== category) ||
existingProduct.active !== product.active ||
/**
* Compare the media arrays with each other and see, if we have other URLs
*/
!compareArraysWithoutOrder(
existingProduct.media.map((m) => ({
url: m.url,
type: m.type,
})),
this.getTotalMediaFromProduct(product).map((m) => ({
url: m.url,
type: m.type,
})),
)
) {
/**
* log, which fields have changed
Expand Down Expand Up @@ -1732,11 +1729,6 @@ export class KencoveApiAppProductSyncService {
),
},
);
console.log(
"CATEGORY",
existingProduct.categoryId,
category,
);

existingProduct = await this.updateProductSchemabase(
product,
Expand Down

0 comments on commit 2bf363f

Please sign in to comment.