Skip to content

Commit

Permalink
chore: remove debug changes
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Dec 10, 2024
1 parent 1282cb0 commit 431c364
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ export class SearchIndexItem {
inStock?: boolean;
// Added dynamically based on the `indexStockStatus` init option.
productInStock?: boolean;
// Added dynamically based TODO
// Added dynamically based on the `indexCurrencyCode` init option.
currencyCode?: CurrencyCode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -444,20 +444,17 @@ export class IndexerController {
const ch = new Channel({ ...channel, defaultCurrencyCode: currencyCode });
ctx.setChannel(ch);

const mutatedVariant = await this.productPriceApplicator.applyChannelPriceAndTax(
variant,
ctx,
);
await this.productPriceApplicator.applyChannelPriceAndTax(variant, ctx);

const item = new SearchIndexItem({
channelId: ctx.channelId,
languageCode,
currencyCode,
productVariantId: mutatedVariant.id,
price: mutatedVariant.price,
priceWithTax: mutatedVariant.priceWithTax,
sku: mutatedVariant.sku,
enabled: product.enabled === false ? false : mutatedVariant.enabled,
productVariantId: variant.id,
price: variant.price,
priceWithTax: variant.priceWithTax,
sku: variant.sku,
enabled: product.enabled === false ? false : variant.enabled,
slug: productTranslation?.slug ?? '',
productId: product.id,
productName: productTranslation?.name ?? '',
Expand All @@ -467,20 +464,16 @@ export class IndexerController {
productPreviewFocalPoint: product.featuredAsset
? product.featuredAsset.focalPoint
: null,
productVariantPreviewFocalPoint: mutatedVariant.featuredAsset
? mutatedVariant.featuredAsset.focalPoint
: null,
productVariantAssetId: mutatedVariant.featuredAsset
? mutatedVariant.featuredAsset.id
productVariantPreviewFocalPoint: variant.featuredAsset
? variant.featuredAsset.focalPoint
: null,
productVariantAssetId: variant.featuredAsset ? variant.featuredAsset.id : null,
productPreview: product.featuredAsset ? product.featuredAsset.preview : '',
productVariantPreview: mutatedVariant.featuredAsset
? mutatedVariant.featuredAsset.preview
: '',
productVariantPreview: variant.featuredAsset ? variant.featuredAsset.preview : '',
channelIds: channelIds.map(x => x.toString()),
facetIds: this.getFacetIds(variant, product),
facetValueIds: this.getFacetValueIds(variant, product),
collectionIds: mutatedVariant.collections.map(c => c.id.toString()),
collectionIds: variant.collections.map(c => c.id.toString()),
collectionSlugs:
collectionTranslations.map(c => c?.slug).filter(notNullOrUndefined) ?? [],
});
Expand All @@ -489,14 +482,14 @@ export class IndexerController {
0 < (await this.productVariantService.getSaleableStockLevel(ctx, variant));
const productInStock = await this.requestContextCache.get(
ctx,
`productVariantsStock-${mutatedVariant.productId}`,
`productVariantsStock-${variant.productId}`,
() =>
this.connection
.getRepository(ctx, ProductVariant)
.find({
loadEagerRelations: false,
where: {
productId: mutatedVariant.productId,
productId: variant.productId,
deletedAt: IsNull(),
},
})
Expand Down

0 comments on commit 431c364

Please sign in to comment.