Commit 98907d9e by Иван Кубота

fix do not contain generated

parent 15ad0f7f
Pipeline #564 failed with stage
...@@ -443,7 +443,9 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers ...@@ -443,7 +443,9 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers
data.more = data.more || []; data.more = data.more || [];
var tid = 1, cid = 1; var tid = 1, cid = 1;
var tagsHash = {}; var tagsHash = {};
/*data.more = data.more.concat([
{c: 'top-35-march-c.csv', q: 'top-35-march-q.csv', a: 'top-35-march-a.csv'}
])*/
data.more = data.more.concat([ data.more = data.more.concat([
{p: '1cards_2020_02_28.csv', i: '1components.csv'}, {p: '1cards_2020_02_28.csv', i: '1components.csv'},
{q: '2questions.csv', a: '2answers.csv', c: '2cards_2020_2_21.csv'}, {q: '2questions.csv', a: '2answers.csv', c: '2cards_2020_2_21.csv'},
...@@ -461,6 +463,11 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers ...@@ -461,6 +463,11 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers
data.connections = []; data.connections = [];
data.standardQuestions = {}; data.standardQuestions = {};
}else{ }else{
data.products = {};
data.components = {};
data.tags = [];
data.connections = [];
data.standardQuestions = {};
for( let i = 0, _i = data.more.length; i < _i; i++ ){ for( let i = 0, _i = data.more.length; i < _i; i++ ){
var adishen = i*300; var adishen = i*300;
...@@ -557,7 +564,6 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers ...@@ -557,7 +564,6 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers
image: String image: String
}, },
postProcess: ( a, inc ) => { postProcess: ( a, inc ) => {
if( a.description.trim() === '' ) return false; if( a.description.trim() === '' ) return false;
a.id = adishen+a.id; a.id = adishen+a.id;
...@@ -580,6 +586,8 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers ...@@ -580,6 +586,8 @@ data = {tags:[], connections:[], more:[], standardQuestions: {}, standardAnswers
}, },
index: 'id' index: 'id'
}) })
console.log(JSON.stringify(Object.values(was), null,2));
} }
if( moreElement.q ){ if( moreElement.q ){
const Q = await readCSV( { const Q = await readCSV( {
......
...@@ -53,14 +53,17 @@ quizTypes.checkbox = [ ComponentsOfProduct = { ...@@ -53,14 +53,17 @@ quizTypes.checkbox = [ ComponentsOfProduct = {
log.push('Generate Answers by `Select components of product` subroutine'); log.push('Generate Answers by `Select components of product` subroutine');
const result = ComponentsOfProduct.answer.call(this, income, log); const result = ComponentsOfProduct.answer.call(this, income, log);
log.push('Reversing'); log.push('Reversing');
const reversed = result const reversed = result
.map(a=>a instanceof Answer.Correct ? new Answer.Wrong(a.text) : new Answer.Correct(a.text)); .map(a=>a instanceof Answer.Correct ? new Answer.Wrong(a.text) : new Answer.Correct(a.text));
const right = reversed.filter(a=>a instanceof Answer.Correct), const right = reversed.filter(a=>a instanceof Answer.Correct),
wrong = reversed.filter(a=>a instanceof Answer.Wrong); wrong = reversed.filter(a=>a instanceof Answer.Wrong);
return shuffle(right.concat(wrong.slice(0, Math.min(this.wrong.max, this.realMaxAnswers - right.length)))); const out = shuffle(right.concat(wrong.slice(0, Math.min(this.wrong.max, this.realMaxAnswers - right.length))));
if(right.length === 0)
return false;
return out;
} }
}), }),
{ {
......
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