Commit 96505d5c by Иван Кубота

change probabilities, fix timeout

parent 38c3d9df
Pipeline #547 canceled with stage
...@@ -629,6 +629,8 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers ...@@ -629,6 +629,8 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers
} }
} }
fs.writeFileSync('./data/tmp/full.json', JSON.stringify(data, null, 2))
data.after && data.after(data); data.after && data.after(data);
})(); })();
......
let ComponentsOfProduct; let ComponentsOfProduct;
quizTypes.checkbox = [ ComponentsOfProduct = { quizTypes.checkbox = [ ComponentsOfProduct = {
probability: 10, probability: 0,//10,
correct: {min: 2, max: 4}, correct: {min: 2, max: 4},
wrong: {min: 1, max: 4}, wrong: {min: 1, max: 4},
answers: {min: 3, max: 6}, answers: {min: 3, max: 6},
...@@ -41,7 +41,7 @@ quizTypes.checkbox = [ ComponentsOfProduct = { ...@@ -41,7 +41,7 @@ quizTypes.checkbox = [ ComponentsOfProduct = {
} }
}, },
Object.assign({}, ComponentsOfProduct, { Object.assign({}, ComponentsOfProduct, {
probability: 4, probability: 0,// 4,
correct: {min: 2, max: 4}, correct: {min: 2, max: 4},
wrong: {min: 2, max: 4}, wrong: {min: 2, max: 4},
answers: {min: 4, max: 8}, answers: {min: 4, max: 8},
...@@ -64,7 +64,7 @@ quizTypes.checkbox = [ ComponentsOfProduct = { ...@@ -64,7 +64,7 @@ quizTypes.checkbox = [ ComponentsOfProduct = {
} }
}), }),
{ {
probability: 10, probability: 0,//10,
correct: {min: 2, max: 4}, correct: {min: 2, max: 4},
wrong: {min: 1, max: 3}, wrong: {min: 1, max: 3},
answers: {min: 4, max: 6}, answers: {min: 4, max: 6},
......
quizTypes.checkboxPhoto = [ quizTypes.checkboxPhoto = [
{ {
questionMinComponentsCount: 2, questionMinComponentsCount: 2,
probability: 8, probability: 0,//8,
type: 'What components are in it', type: 'What components are in it',
answers: {min: 3, max: 6}, answers: {min: 3, max: 6},
...@@ -33,7 +33,7 @@ quizTypes.checkboxPhoto = [ ...@@ -33,7 +33,7 @@ quizTypes.checkboxPhoto = [
}, },
{ {
questionMinComponentsCount: 2, questionMinComponentsCount: 2,
probability: 3, probability: 0,//3,
type: 'What components are NOT in it', type: 'What components are NOT in it',
answers: {min: 3, max: 6}, answers: {min: 3, max: 6},
......
...@@ -17,7 +17,7 @@ quizTypes.radio = [ ...@@ -17,7 +17,7 @@ quizTypes.radio = [
}, },
{ {
questionCmpAmount: 2, questionCmpAmount: 2,
probability: 8, probability: 0,//8,
type: 'Component in product', type: 'Component in product',
products: {from: 4, to: 6}, products: {from: 4, to: 6},
minSimilarTags: 1, minSimilarTags: 1,
...@@ -83,7 +83,7 @@ quizTypes.radio = [ ...@@ -83,7 +83,7 @@ quizTypes.radio = [
} }
}, },
{ {
probability: 10, probability: 0,//10,
answers: {from: 3, to: 6}, answers: {from: 3, to: 6},
question: ({product})=> `Выберите лишний ингредиент, НЕ входящий в продукт "${product.title}"`, question: ({product})=> `Выберите лишний ингредиент, НЕ входящий в продукт "${product.title}"`,
......
...@@ -33,7 +33,7 @@ quizTypes.radioPhoto = [ ...@@ -33,7 +33,7 @@ quizTypes.radioPhoto = [
}, },
{ {
questionMinComponentsCount: 2, questionMinComponentsCount: 2,
probability: 3, probability: 0,//3,
type: 'What component is in it', type: 'What component is in it',
answers: {min: 4, max: 6}, answers: {min: 4, max: 6},
......
...@@ -94,7 +94,11 @@ ${opt.required?'<span class="api-option-required">Required</span>': '<span class ...@@ -94,7 +94,11 @@ ${opt.required?'<span class="api-option-required">Required</span>': '<span class
for(let key in apis){ for(let key in apis){
let api = apis[key], args; let api = apis[key], args;
router[api.method.toLowerCase()](key, async function(req, res) { router[api.method.toLowerCase()](key, async function(req, res) {
let timeout = setTimeout(()=>res.end('Timeout'), 10000); let timeout = setTimeout(()=>{
res.status(408);
res.end('{"error": true, "data": "Timeout"}');
res.connection.destroy();
}, 10000);
try{ try{
args = parseArgs( req, res, api.options ); args = parseArgs( req, res, api.options );
}catch(e){ }catch(e){
......
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