@infrab4a/connect-angular 5.2.1-beta.6 → 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 -20
- package/fesm2015/infrab4a-connect-angular.mjs +0 -18
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +0 -19
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1644,7 +1644,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1644
1644
|
type: Injectable
|
|
1645
1645
|
}], ctorParameters: function () { return [{ type: CatalogRepositoryService }, { type: CatalogHelpersService }]; } });
|
|
1646
1646
|
|
|
1647
|
-
/* eslint-disable no-console */
|
|
1648
1647
|
class TermSearchStrategy {
|
|
1649
1648
|
constructor(repositoryService, helpersService) {
|
|
1650
1649
|
this.repositoryService = repositoryService;
|
|
@@ -1722,30 +1721,13 @@ class TermSearchStrategy {
|
|
|
1722
1721
|
sortByTermRelevance(params) {
|
|
1723
1722
|
const { productIds, totalResult, limits, filters, fieldsHelper } = params;
|
|
1724
1723
|
// const defaultGender = filters?.gender?.at(0) || 'male'
|
|
1725
|
-
console.log('productIds', productIds);
|
|
1726
1724
|
const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
|
|
1727
|
-
console.log('stockData', stockData);
|
|
1728
1725
|
const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
|
|
1729
|
-
console.log('stockOut', stockOut);
|
|
1730
|
-
// const productIdsStockGender = productIds.filter((product) => stockData.some((result: any) => result.id === product))
|
|
1731
|
-
// && (result.gender?.includes(defaultGender) || result.gender?.includes('unisex'))
|
|
1732
|
-
// const productIdsStockNotGender = productIds.filter((product) =>
|
|
1733
|
-
// stockData.some((result: any) => result.id === product),
|
|
1734
|
-
// )
|
|
1735
|
-
// && !result.gender?.includes(defaultGender) && !result.gender?.includes('unisex')
|
|
1736
|
-
// const productIdsStock = productIdsStockGender.concat(productIdsStockNotGender)
|
|
1737
1726
|
const productIdsStock = productIds.filter((product) => stockData.some((result) => result.id === product));
|
|
1738
|
-
console.log('productIdsStock', productIdsStock);
|
|
1739
1727
|
const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
|
|
1740
|
-
console.log('productIdsStockOut', productIdsStockOut);
|
|
1741
|
-
console.log('concat', productIdsStock.concat(productIdsStockOut));
|
|
1742
1728
|
const limitedProductId = productIdsStock
|
|
1743
1729
|
.concat(productIdsStockOut)
|
|
1744
1730
|
.slice(limits.offset, limits.offset + limits.limit);
|
|
1745
|
-
console.log('limitedProductId', limitedProductId);
|
|
1746
|
-
// const orderedId = productIds.filter((product) => limitedProductId.includes(product))
|
|
1747
|
-
// const orderedId = productIds.filter((product) => limitedProductId.some((p) => p === product))
|
|
1748
|
-
// console.log('orderedId', orderedId)
|
|
1749
1731
|
return this.getDetailedProducts(limitedProductId, totalResult, fieldsHelper);
|
|
1750
1732
|
}
|
|
1751
1733
|
async getDetailedProducts(orderedId, totalResult, fieldsHelper) {
|
|
@@ -1757,7 +1739,6 @@ class TermSearchStrategy {
|
|
|
1757
1739
|
},
|
|
1758
1740
|
fields,
|
|
1759
1741
|
});
|
|
1760
|
-
console.log('detail ordered', orderedId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean));
|
|
1761
1742
|
return {
|
|
1762
1743
|
data: orderedId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean),
|
|
1763
1744
|
count: totalResult.count,
|