Wix gift quiz does nott work!!!!

I have spent over 20 hours trying to understand the gift quiz and I can’t seem to understand what did do wrong, I did everything on the video and on the page where it’s explained and it doesn’t work, I even did everything the same to at least have it working but it doesn’t work! please anyone help me resolve this problem!

i currently have this code on my page fore the quiz:

import wixData from ‘wix-data’;
const selectedAnswers = [];
const quizAnswersIds = [“MALE”, “FEMALE”, “MYSELF”,
“17”, “18TO30”, “35PLUS”, “MUSCLE”,
“HEALTHY”, “ENDURANCE”, “LOSEEIGHT”
];
let numberOfSlides;
$w.onReady(() => {
numberOfSlides = $w(‘#quizSlides’).slides.length;
quizAnswersIds.forEach(answers => {
$w(#${answers}).onClick(() => {
selectedAnswers.push(answers);
$w(‘#quizSlides’).next();
})
})
});
export async function quizSlides_change(event, $w) {
if (isQuizFinished()) {
let quizProducts = await getKeywordsPerProduct();
selectedAnswers.forEach(answer => {
quizProducts = filterProductsPerAnswer(quizProducts, answer);
});
quizProducts = quizProducts.map(quizProduct => quizProduct.productId);
quizProducts = getRandomItemsFromArray(quizProducts, numberOfSlides);
$w(‘#recommendedProducts’).data = await getProductsData(quizProducts);
}
}
function isQuizFinished() {
return $w(‘#quizSlides’).currentIndex === numberOfSlides - 1;
}
async function getKeywordsPerProduct() {
let productsKeywords = await wixData.query(“productsKeywords”).find();
productsKeywords = productsKeywords.items;
productsKeywords = productsKeywords.map(item => {
return {
productId: item.product,
keywords: item.keywords.split(“,”)
}
});
return productsKeywords;
}
function filterProductsPerAnswer(quizProducts, answer) {
const filteredProducts = quizProducts.filter(quizProduct => {
return quizProduct.keywords.includes(answer)
});
return filteredProducts;
}
function getRandomItemsFromArray(productsArr, numberOfItems){
const productsIds = [];
const numberOfProducts = productsArr.length;
for (let i = 0; i < numberOfItems && i < numberOfProducts; i++){
const randomIndex = getRandomInt(0, numberOfProducts -1 );
productsIds.push(productsArr[randomIndex]);
productsArr.splice(randomIndex, 1);
}
return productsIds;
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
async function getProductsData(productsIds) {
const productsData = await wixData.query(“Stores/Products”)
.hasSome(“_id”, productsIds)
.find();
return productsData.items;
}
export function recommendedProducts_itemReady($item, itemData, index) {
$item(‘#name’).text = itemData.name;
$item(‘#image’).src = itemData.mainMedia;
$item(‘#image’).link = itemData.productPageUrl;
$item(‘#price’).text = itemData.formattedPrice;
}

Make sure that your quizAnswersIds are exactly the same in your code as they are in the dataset field too. You will notice that the tutorial code has them all in lower case as the field in the dataset is all in lowercase too.

If your code has them in uppercase and they are in your dataset field as capital and lowercase or all lowercase, then you need to change them to suit.

const quizAnswersIds = ["bestie", "girlfriend", "myself",
 "surpriseMe", "accessories", "clothing", "beauty",
 "surpriseMe2", "gold", "red", "lavender"

Also check your code as lines you’ve got:

selectedAnswers.push(answers);
// when it should be
selectedAnswers.push(answer);
quizAnswersIds.forEach(answers => {
// when it should be 
quizAnswersIds.forEach(answer => {
$w(`#${answers}`).onClick(() => {
 // when it should be  
$w(`#${answer}`).onClick(() => {

everything works but the end, the slide to the next question the clicking all that, just doesnt apear any product at the end.