Commit 352493fa by Иван Кубота

productId

parent cd45ee72
Pipeline #524 failed with stage
......@@ -106,6 +106,7 @@ quizTypes.checkbox = [ ComponentsOfProduct = {
log.push('Chosen component: '+chosen.component.name);
return {
baseProduct: chosen.products[0],
component: chosen.component,
correct: chosen.products,
wrong: products.filter(p=>chosen.products.indexOf(p)===-1)
......
......@@ -194,6 +194,7 @@ const qB = {
wrong.splice(i,1);
return {
baseProduct: product,
correct: product,
wrong: wrong,
uniq: used,
......
......@@ -86,11 +86,15 @@ quizTypes.radio = [
probability: 10,
answers: {from: 3, to: 6},
question: (product)=> `Выберите лишний ингредиент, НЕ входящий в продукт "${product.title}"`,
question: ({product})=> `Выберите лишний ингредиент, НЕ входящий в продукт "${product.title}"`,
type: 'Do not contain',
from: (log)=>qB.randomProduct({ minComponents: 2, single: true }, log),
from: (log)=>{
const product = qB.randomProduct({ minComponents: 2, single: true }, log);
return {baseProduct: product, product}
answer( product, log ){
},
answer( {product}, log ){
const out =
shuffle(
......
......@@ -91,7 +91,18 @@ const quizGenerator = function(type, photo, subType) {
// давай по новой
return _quizGenerator( type, photo, subType, attempt + 1 );
}
return {seed: initialSeed, question: cfg.question.call(cfg, source, log), answers, log, type, image: !photo?'':true, category: 1}
return {
seed: initialSeed,
type,
categoryId: 1,
productId: source.baseProduct.id,
question: cfg.question.call(cfg, source, log),
answers,
image: !photo?null:true,
log,
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment