@infrab4a/connect-angular 5.2.1-beta.7 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/services/catalog/strategies/term-search.strategy.mjs +1 -22
- package/fesm2015/infrab4a-connect-angular.mjs +0 -21
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +0 -21
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1721,30 +1721,13 @@ class TermSearchStrategy {
|
|
|
1721
1721
|
sortByTermRelevance(params) {
|
|
1722
1722
|
const { productIds, totalResult, limits, filters, fieldsHelper } = params;
|
|
1723
1723
|
// const defaultGender = filters?.gender?.at(0) || 'male'
|
|
1724
|
-
// console.log('productIds', productIds)
|
|
1725
1724
|
const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
|
|
1726
|
-
// console.log('stockData', stockData)
|
|
1727
1725
|
const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
|
|
1728
|
-
// console.log('stockOut', stockOut)
|
|
1729
|
-
// const productIdsStockGender = productIds.filter((product) => stockData.some((result: any) => result.id === product))
|
|
1730
|
-
// && (result.gender?.includes(defaultGender) || result.gender?.includes('unisex'))
|
|
1731
|
-
// const productIdsStockNotGender = productIds.filter((product) =>
|
|
1732
|
-
// stockData.some((result: any) => result.id === product),
|
|
1733
|
-
// )
|
|
1734
|
-
// && !result.gender?.includes(defaultGender) && !result.gender?.includes('unisex')
|
|
1735
|
-
// const productIdsStock = productIdsStockGender.concat(productIdsStockNotGender)
|
|
1736
1726
|
const productIdsStock = productIds.filter((product) => stockData.some((result) => result.id === product));
|
|
1737
|
-
// console.log('productIdsStock', productIdsStock)
|
|
1738
1727
|
const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
|
|
1739
|
-
// console.log('productIdsStockOut', productIdsStockOut)
|
|
1740
|
-
// console.log('concat', productIdsStock.concat(productIdsStockOut))
|
|
1741
1728
|
const limitedProductId = productIdsStock
|
|
1742
1729
|
.concat(productIdsStockOut)
|
|
1743
1730
|
.slice(limits.offset, limits.offset + limits.limit);
|
|
1744
|
-
// console.log('limitedProductId', limitedProductId)
|
|
1745
|
-
// const orderedId = productIds.filter((product) => limitedProductId.includes(product))
|
|
1746
|
-
// const orderedId = productIds.filter((product) => limitedProductId.some((p) => p === product))
|
|
1747
|
-
// console.log('orderedId', orderedId)
|
|
1748
1731
|
return this.getDetailedProducts(limitedProductId, totalResult, fieldsHelper);
|
|
1749
1732
|
}
|
|
1750
1733
|
async getDetailedProducts(orderedId, totalResult, fieldsHelper) {
|
|
@@ -1756,10 +1739,6 @@ class TermSearchStrategy {
|
|
|
1756
1739
|
},
|
|
1757
1740
|
fields,
|
|
1758
1741
|
});
|
|
1759
|
-
// console.log(
|
|
1760
|
-
// 'detail ordered',
|
|
1761
|
-
// orderedId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean),
|
|
1762
|
-
// )
|
|
1763
1742
|
return {
|
|
1764
1743
|
data: orderedId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean),
|
|
1765
1744
|
count: totalResult.count,
|