review bug
This commit is contained in:
@@ -90,8 +90,9 @@ router.get('/:id/reviews', async (req, res) => {
|
|||||||
where: {
|
where: {
|
||||||
itemId: req.params.id,
|
itemId: req.params.id,
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
rating: { [Op.not]: null },
|
itemRating: { [Op.not]: null },
|
||||||
review: { [Op.not]: null }
|
itemReview: { [Op.not]: null },
|
||||||
|
itemReviewVisible: true
|
||||||
},
|
},
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
@@ -104,7 +105,7 @@ router.get('/:id/reviews', async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const averageRating = reviews.length > 0
|
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;
|
: 0;
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
|
|||||||
Reference in New Issue
Block a user