review bug
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user