Skip to content

Commit

Permalink
Fix multi script error
Browse files Browse the repository at this point in the history
  • Loading branch information
Syno committed Oct 11, 2019
1 parent 473f326 commit eaf440a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions routes/instruction_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,7 @@ router.post('/execute', block_access.isLoggedIn, multer({
dest: './upload/'
}).single('instructions'), function(req, res) {

// Reset idxAtMandatoryInstructionStart to handle multiple scripts execution
idxAtMandatoryInstructionStart = -1;

var userId = req.session.passport.user.id;

// Init scriptData object for user. (session simulation)
scriptData[userId] = {
over: false,
Expand All @@ -335,6 +331,9 @@ router.post('/execute', block_access.isLoggedIn, multer({
return res.end();
}

// Reset idxAtMandatoryInstructionStart to handle multiple scripts execution
idxAtMandatoryInstructionStart = -1;

scriptProcessing.state = true;
scriptProcessing.timeout = moment();

Expand Down Expand Up @@ -573,9 +572,6 @@ router.post('/execute', block_access.isLoggedIn, multer({
/* Execute when it's not a file upload but a file written in textarea */
router.post('/execute_alt', block_access.isLoggedIn, function(req, res) {

// Reset idxAtMandatoryInstructionStart to handle multiple scripts execution
idxAtMandatoryInstructionStart = -1;

let userId = req.session.passport.user.id;
let __ = require("../services/language")(req.session.lang_user).__;

Expand Down Expand Up @@ -604,6 +600,9 @@ router.post('/execute_alt', block_access.isLoggedIn, function(req, res) {
return res.end();
}

// Reset idxAtMandatoryInstructionStart to handle multiple scripts execution
idxAtMandatoryInstructionStart = -1;

scriptProcessing.state = true;
scriptProcessing.timeout = moment();

Expand Down

0 comments on commit eaf440a

Please sign in to comment.