Pug iteration passing bug
Felixmurithi opened this issue · 0 comments
Felixmurithi commented
Pug v 2.0.3
Node v20.9.0
Input Pug
section.section-reviews
.reviews
each review, i in tour.reviews
// - console.log(review)
+reviewCard(review)
reviewCard from
mixin reviewCard(review)
- console.log(review)
- const rating= review.rating
- const [reviewer]= review.user
.reviews__card
.reviews__avatar
img.reviews__avatar-img(src=`/img/users/${reviewer.photo}` alt=`${reviewer.name}`)
h6.reviews__user= reviewer.name
p.reviews__text Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque dignissimos sint quo commodi corrupti accusantium veniam saepe numquam.
.reviews__rating
each star in [1,2, 3, 4, 5]
svg.reviews__star(class= `reviews__star--${review.rating>= start? 'active': 'inactive'}`)
use(xlink:href='/img/icons.svg#icon-star')
Pug error - const rating= review.rating
- outputs all the reviews from tour.reviews
however, - const [reviewer]= review.user
does output only 1 user