Commit 2e638366 by Иван Кубота

do not group components and pictures by test categories

parent d107ab3a
Pipeline #569 failed with stage
...@@ -177,6 +177,7 @@ const qB = { ...@@ -177,6 +177,7 @@ const qB = {
tags, tags,
minMatch minMatch
}){ }){
tags = tags.filter(t=>t.type_id===1);
if(minMatch === void 0){ if(minMatch === void 0){
minMatch = tags.length; minMatch = tags.length;
} }
......
...@@ -65,7 +65,7 @@ const standardGenerator = function(random) { ...@@ -65,7 +65,7 @@ const standardGenerator = function(random) {
q.answers.forEach( q.answers.forEach(
a => a =>
log.push((a.correct?'+':' ')+` > ${a.title}`)); log.push((a.correct?'+':' ')+` > ${a.title}`));
debugger //debugger
return { return {
type: q.multiple ? 'checkbox': 'radio', type: q.multiple ? 'checkbox': 'radio',
categoryId: q.category_id, categoryId: q.category_id,
......
...@@ -39,8 +39,12 @@ var ctxCtor = new Function('',body); ...@@ -39,8 +39,12 @@ var ctxCtor = new Function('',body);
var ctx; var ctx;
var initCtx = function() { var initCtx = function() {
let ctxready = ctx && ctx.ready,
ctxr = ctx && ctx._r;
ctx = ctxCtor(); ctx = ctxCtor();
ctx.ready = new Promise((r,j)=>{ ctx._r = ctxr;
ctx.ready = ctxready || new Promise((r,j)=>{
ctx._r = r; ctx._r = r;
}); });
ctx.setData = function(dataSet) { ctx.setData = function(dataSet) {
...@@ -48,7 +52,7 @@ var initCtx = function() { ...@@ -48,7 +52,7 @@ var initCtx = function() {
countStdQ = Object.values(dataSet.standardQuestions).length; countStdQ = Object.values(dataSet.standardQuestions).length;
//console.log(ctx.dP) //console.log(ctx.dP)
data = dataSet data = dataSet
ctx._r();
}; };
}; };
const normalizeText = function(text) { const normalizeText = function(text) {
...@@ -65,7 +69,9 @@ data.after = function(inComeData, skipInit){ ...@@ -65,7 +69,9 @@ data.after = function(inComeData, skipInit){
} }
ctx.setData(theData=inComeData); ctx.setData(theData=inComeData);
standardQuestions = inComeData.standardQuestions; standardQuestions = inComeData.standardQuestions;
firstRequest(); firstRequest(true);
//ctx._r();
} }
}; };
...@@ -100,6 +106,7 @@ const readCSV = async function(scope) { ...@@ -100,6 +106,7 @@ const readCSV = async function(scope) {
}; };
let afterLoaded = async function(infoHash) { let afterLoaded = async function(infoHash) {
ctx._r();
return;// everything imported return;// everything imported
let categoryID = 5; let categoryID = 5;
console.log('Importing category:', categoryID); console.log('Importing category:', categoryID);
...@@ -284,6 +291,7 @@ let inc = 1; ...@@ -284,6 +291,7 @@ let inc = 1;
}*/ }*/
} }
} }
...@@ -320,7 +328,7 @@ module.exports = { ...@@ -320,7 +328,7 @@ module.exports = {
if( error ) throw new Error( error ); if( error ) throw new Error( error );
var s = data, var s = data,
l = JSON.parse( response.body ); l = JSON.parse( response.body );
console.log('Request: category loaded');
var options = { var options = {
'method': 'GET', 'method': 'GET',
...@@ -330,7 +338,7 @@ module.exports = { ...@@ -330,7 +338,7 @@ module.exports = {
request( options, function( error, response ){ request( options, function( error, response ){
if( error ) throw new Error( error ); if( error ) throw new Error( error );
var tags = JSON.parse( response.body ); var tags = JSON.parse( response.body );
console.log('Request: tag loaded');
var options = { var options = {
'method': 'GET', 'method': 'GET',
'url': 'https://api.new.local.vkusvill.testin.ru/api/admin/question/', 'url': 'https://api.new.local.vkusvill.testin.ru/api/admin/question/',
...@@ -339,6 +347,8 @@ module.exports = { ...@@ -339,6 +347,8 @@ module.exports = {
request( options, function( error, response ){ request( options, function( error, response ){
if( error ) throw new Error( error ); if( error ) throw new Error( error );
var questions = JSON.parse( response.body ); var questions = JSON.parse( response.body );
console.log('Request: question loaded');
var qCardHash = {}, infoHash = {}; var qCardHash = {}, infoHash = {};
questions.forEach(function(q) { questions.forEach(function(q) {
......
...@@ -154,7 +154,7 @@ ${opt.required?'<span class="api-option-required">Required</span>': '<span class ...@@ -154,7 +154,7 @@ ${opt.required?'<span class="api-option-required">Required</span>': '<span class
}catch(e){ }catch(e){
} }
}, 10000); }, 30000);
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