Skip to content

Commit b0e12b4

Browse files
committed
Fix: rating filter now shows only exact star matches across categories
1 parent de1a6ca commit b0e12b4

17 files changed

+30
-54
lines changed

package-lock.json

Lines changed: 0 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/User/pages/Latest_in_the_Market/ArtSupplies.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function ArtSupplies() {
7474
}
7575
if (ratingFilter) {
7676
updatedProducts = updatedProducts.filter(
77-
(product) => Math.round(product.rating.rate) >= ratingFilter
77+
(product) => Math.round(product.rating.rate) === ratingFilter
7878
);
7979
}
8080
setFilteredProducts(updatedProducts);

src/User/pages/Latest_in_the_Market/BambooProducts.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function BambooProducts() {
3535
image: product.images[0] || "",
3636
discountPercentage: product.discountPercentage,
3737
rating: {
38-
rate: product.rating,
38+
rate: Math.round(product.rating),
3939
count: product.reviews ? product.reviews.length : 0,
4040
},
4141
}));
@@ -74,7 +74,7 @@ function BambooProducts() {
7474
}
7575
if (ratingFilter) {
7676
updatedProducts = updatedProducts.filter(
77-
(product) => Math.round(product.rating.rate) >= ratingFilter
77+
(product) => product.rating.rate === ratingFilter
7878
);
7979
}
8080
setFilteredProducts(updatedProducts);

src/User/pages/Latest_in_the_Market/CeramicDinnerware.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function CeramicDinnerware() {
3535
image: product.images[0] || "",
3636
discountPercentage: product.discountPercentage,
3737
rating: {
38-
rate: product.rating,
38+
rate: Math.round(product.rating),
3939
count: product.reviews ? product.reviews.length : 0,
4040
},
4141
}));
@@ -74,7 +74,7 @@ function CeramicDinnerware() {
7474
}
7575
if (ratingFilter) {
7676
updatedProducts = updatedProducts.filter(
77-
(product) => Math.round(product.rating.rate) >= ratingFilter
77+
(product) => product.rating.rate === ratingFilter
7878
);
7979
}
8080
setFilteredProducts(updatedProducts);

src/User/pages/Latest_in_the_Market/HandMadeSoaps.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function HandMadeSoaps() {
3434
image: product.images[0] || "",
3535
discountPercentage: product.discountPercentage,
3636
rating: {
37-
rate: product.rating,
37+
rate: Math.round(product.rating),
3838
count: product.reviews ? product.reviews.length : 0,
3939
},
4040
}));
@@ -73,7 +73,7 @@ function HandMadeSoaps() {
7373
}
7474
if (ratingFilter) {
7575
updatedProducts = updatedProducts.filter(
76-
(product) => Math.round(product.rating.rate) >= ratingFilter
76+
(product) => product.rating.rate === ratingFilter
7777
);
7878
}
7979
setFilteredProducts(updatedProducts);

src/User/pages/Latest_in_the_Market/NaturalCosmetics.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function NaturalCosmetics() {
3535
image: product.images[0] || "",
3636
discountPercentage: product.discountPercentage,
3737
rating: {
38-
rate: product.rating,
38+
rate: Math.round(product.rating),
3939
count: product.reviews ? product.reviews.length : 0,
4040
},
4141
}));
@@ -74,7 +74,7 @@ function NaturalCosmetics() {
7474
}
7575
if (ratingFilter) {
7676
updatedProducts = updatedProducts.filter(
77-
(product) => Math.round(product.rating.rate) >= ratingFilter
77+
(product) => product.rating.rate === ratingFilter
7878
);
7979
}
8080
setFilteredProducts(updatedProducts);

src/User/pages/Latest_in_the_Market/OrganicSoaps.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function OrganicSoaps() {
3535
image: product.images[0] || "",
3636
discountPercentage: product.discountPercentage,
3737
rating: {
38-
rate: product.rating,
38+
rate: Math.round(product.rating),
3939
count: product.reviews ? product.reviews.length : 0,
4040
},
4141
}));
@@ -74,7 +74,7 @@ function OrganicSoaps() {
7474
}
7575
if (ratingFilter) {
7676
updatedProducts = updatedProducts.filter(
77-
(product) => Math.round(product.rating.rate) >= ratingFilter
77+
(product) => product.rating.rate === ratingFilter
7878
);
7979
}
8080
setFilteredProducts(updatedProducts);

src/User/pages/Latest_in_the_Market/OrganicTea.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function OrganicTea() {
3434
image: product.images[0] || "",
3535
discountPercentage: product.discountPercentage,
3636
rating: {
37-
rate: product.rating,
37+
rate: Math.round(product.rating),
3838
count: product.reviews ? product.reviews.length : 0,
3939
},
4040
}));
@@ -73,7 +73,7 @@ function OrganicTea() {
7373
}
7474
if (ratingFilter) {
7575
updatedProducts = updatedProducts.filter(
76-
(product) => Math.round(product.rating.rate) >= ratingFilter
76+
(product) => product.rating.rate === ratingFilter
7777
);
7878
}
7979
setFilteredProducts(updatedProducts);

src/User/pages/Latest_in_the_Market/StorageBaskets.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function StorageBaskets() {
3434
image: product.images[0] || "",
3535
discountPercentage: product.discountPercentage,
3636
rating: {
37-
rate: product.rating,
37+
rate: Math.round(product.rating),
3838
count: product.reviews ? product.reviews.length : 0,
3939
},
4040
}));
@@ -73,7 +73,7 @@ function StorageBaskets() {
7373
}
7474
if (ratingFilter) {
7575
updatedProducts = updatedProducts.filter(
76-
(product) => Math.round(product.rating.rate) >= ratingFilter
76+
(product) => product.rating.rate === ratingFilter
7777
);
7878
}
7979
setFilteredProducts(updatedProducts);

src/User/pages/Popular_Categories/Beauty-Wellness.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function BeautyWellness() {
3232
image: product.images[0] || "",
3333
discountPercentage: product.discountPercentage,
3434
rating: {
35-
rate: product.rating,
35+
rate: Math.round(product.rating),
3636
count: product.reviews ? product.reviews.length : 0,
3737
},
3838
}));
@@ -71,7 +71,7 @@ function BeautyWellness() {
7171
}
7272
if (ratingFilter) {
7373
updatedProducts = updatedProducts.filter(
74-
(product) => Math.round(product.rating.rate) >= ratingFilter
74+
(product) => product.rating.rate === ratingFilter
7575
);
7676
}
7777
setFilteredProducts(updatedProducts);

0 commit comments

Comments
 (0)