review bug

This commit is contained in:
jackiettran
2025-09-04 22:02:49 -04:00
parent bbab991e31
commit 69bf64fe70

View File

@@ -90,8 +90,9 @@ router.get('/:id/reviews', async (req, res) => {
where: {
itemId: req.params.id,
status: 'completed',
rating: { [Op.not]: null },
review: { [Op.not]: null }
itemRating: { [Op.not]: null },
itemReview: { [Op.not]: null },
itemReviewVisible: true
},
include: [
{
@@ -104,7 +105,7 @@ router.get('/:id/reviews', async (req, res) => {
});
const averageRating = reviews.length > 0
? reviews.reduce((sum, review) => sum + review.rating, 0) / reviews.length
? reviews.reduce((sum, review) => sum + review.itemRating, 0) / reviews.length
: 0;
res.json({