Commit 20843987 by Иван Кубота

remove ingredient questions

parent a98f97f6
Pipeline #556 failed with stage
quizTypes.checkboxPhoto = [
{
questionMinComponentsCount: 2,
probability: 8,
probability: 0,//8,
type: 'What components are in it',
answers: {min: 3, max: 6},
......
quizTypes.radio = [
{
questionCmpAmount: 4,
probability: 10,
probability: 0,//10,
type: 'Product contains 4 components',
products: {from: 4, to: 8},
minSimilarTags: 1,
......
......@@ -24,7 +24,7 @@ view.cmp.Table.prototype = {
this.filterRegExp = new RegExp(text.replace(/[\[\]\(\)\?\*\.\+]/g,'').replace(/\s+/g,'|'), 'ig')
},
fetch: function() {
const field = Object.keys(this.sort[0])[0]
const field = Object.keys(this.sort[0])[0];
this.currentSlice = this.items
.filter(item=>this.filterFn.call(item, this.filterText, this))
.sort((a,b)=>a[field] > b.field ? 1 : a[field] < b.field ? -1 : 0)
......@@ -46,6 +46,14 @@ view.cmp.Table.prototype = {
item.dom = dom;
}
},
removeChild: function(item) {
if(item.dom){
item.dom.parentNode.removeChild(item.dom);
item.dom = null;
this.currentSlice = this.currentSlice.filter(i=>!(i.data===item.data));
this.items = this.items.filter(i=>!(i===item.data));
}
},
updateChildByData: function(data) {
const match = this.currentSlice.filter(i=>i.data===data),
item = match[0];
......
......@@ -226,7 +226,7 @@ pre {font-family: monospace;}
</style><script>var toggle=function(a){a.parentNode.parentNode.querySelector('.how-block').classList.toggle('hidden')}</script>`+'</head><body><div class="seed">seed: '+seed+'</div> ' +
list.map((result, i)=>
`<div class="quest"><div class="title">${i+1}) ${result.question} <span class="how" onclick="toggle(this)">Как так получилось?</span></div>
<pre>
<pre>${result.image?'<img height="100px" src="'+TRANSFORMER.IMAGE(result.image)+'" style="float: left"/>':''}
${ result.answers.map(a=>
( (result.type==='checkbox'?(a.correct?'[v]':'[ ]'):(a.correct?'(o)':'( )'))+ ' '+a.text)
).join('\n')}
......@@ -244,3 +244,19 @@ ${ result.answers.map(a=>
}
}
};
const TRANSFORMER = {
IMAGE: function( image ){
if( !image ){
}else{
image = image.trim();
if( image.indexOf( '/upload/resize' ) === 0 ){
image = 'https://vkusvill.ru' + image;
}else{
image = image ? 'https://api.new.local.vkusvill.testin.ru/storage' + image.trim() : void 0;
}
}
return image;
}
}
\ No newline at end of file
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