Browse Source

Enviando o integrations-functions

Igor 5 years ago
parent
commit
ec6008c6dd

+ 10 - 14
build/ivprog.bundle.js

@@ -176,7 +176,7 @@ module.exports =
 /* 0 */
 /***/ (function(module, exports, __webpack_require__) {
 
-// Generated from /tmp/tmp-466621eJzKCqIzpf/ivprog.g4 by ANTLR 4.7
+// Generated from /tmp/tmp-4669TPRc9fhGuNBI/ivprog.g4 by ANTLR 4.7
 // jshint ignore: start
 var antlr4 = __webpack_require__(2);
 
@@ -767,7 +767,7 @@ module.exports =
 /* 0 */
 /***/ (function(module, exports, __webpack_require__) {
 
-// Generated from /tmp/tmp-4666lZ30R1K3nH8H/ivprog.g4 by ANTLR 4.7
+// Generated from /tmp/tmp-466941BXYZlX19TS/ivprog.g4 by ANTLR 4.7
 // jshint ignore: start
 var antlr4 = __webpack_require__(2);
 
@@ -1421,7 +1421,7 @@ module.exports =
 /* 0 */
 /***/ (function(module, exports, __webpack_require__) {
 
-// Generated from /tmp/tmp-4666V9aIMKyWvsHd/ivprog.g4 by ANTLR 4.7
+// Generated from /tmp/tmp-466977hYKcv8VRFx/ivprog.g4 by ANTLR 4.7
 // jshint ignore: start
 var antlr4 = __webpack_require__(2);
 
@@ -3613,9 +3613,7 @@ var IVProgAssessment = exports.IVProgAssessment = function () {
           return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
         });
         var testResult = partialTests.reduce(function (acc, curr) {
-          return acc.then(function (v) {
-            return curr(v);
-          });
+          return acc.then(curr);
         }, Promise.resolve(0));
         return testResult.then(function (total) {
           return Promise.resolve(total / _this.testCases.length);
@@ -16698,13 +16696,13 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
 
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
-var block_render = false;
+window.block_render = false;
 
 function renderAlgorithm() {
-	if (block_render) {
+	if (window.block_render) {
 		return;
 	}
-	block_render = true;
+	window.block_render = true;
 
 	(0, _jquery2.default)('.all_functions').children().off();
 	(0, _jquery2.default)('.all_functions').empty();
@@ -16721,7 +16719,7 @@ function renderAlgorithm() {
 	}
 
 	setTimeout(function () {
-		block_render = false;
+		window.block_render = false;
 	}, 500);
 }
 
@@ -22155,7 +22153,7 @@ function addHandlers(command, function_obj, writer_dom) {
 		handle: '.ellipsis',
 		animation: 100,
 		ghostClass: 'ghost',
-		group: 'writer',
+		group: 'writer_' + Math.floor(Math.random() * 10000000),
 		draggable: '.div_parent_handler',
 		onEnd: function onEnd(evt) {
 
@@ -22785,8 +22783,6 @@ var is_iassign = false;
       updateSequenceGlobals(evt.oldIndex, evt.newIndex);
     }
   });
-
-  renderAlgorithm();
 });
 
 function updateSequenceParameters(oldIndex, newIndex, function_obj) {
@@ -22827,7 +22823,7 @@ function runCodeAssessment() {
       is_iassign = false;
     }
   }).catch(function (err) {
-    return domConsole.err(err.message);
+    return console.log(err);
   });
 }
 

File diff suppressed because it is too large
+ 1 - 1
build/ivprog.bundle.js.map


+ 18 - 3
js/iassign-integration-functions.js

@@ -30,7 +30,12 @@ function getAnswer () {
         // Montar o retorno com a resposta do aluno
         var contentToSend = previousContent.split("\n::algorithm::")[0];
         contentToSend += '\n::algorithm::\n';
-        contentToSend += JSON.stringify(window.program_obj);
+        contentToSend += JSON.stringify(window.program_obj, function(key, value) {
+            if (key == 'dom_object') {
+                return;
+            }
+            return value; 
+        });
 
         contentToSend += '\n::logs::';
         contentToSend += getTrackingLogs();
@@ -47,10 +52,17 @@ function getAnswer () {
 
         if ($("input[name='include_algo']").is(':checked')) {
             ret += '\n::algorithm::\n';
-            ret += JSON.stringify(window.program_obj);
+            ret += JSON.stringify(window.program_obj, function(key, value) {
+                
+                if (key == 'dom_object') {
+                    return;
+                }
+                return value; 
+            });
         }
 
         return ret;
+
     }
 }
 
@@ -123,6 +135,9 @@ function getiLMContent () {
             previousContent = data;
             prepareActivityToEdit(data);
         }
+
+        window.block_render = false;
+        renderAlgorithm();
     });
 }
 
@@ -432,7 +447,7 @@ $( document ).ready(function() {
         orderIcons();
         orderWidth();
     }
-
+    renderAlgorithm();
 });
 
 function orderWidth() {

+ 4 - 4
js/visualUI/algorithm.js

@@ -13,13 +13,13 @@ import { IVProgParser } from './../ast/ivprogParser';
 import { IVProgProcessor } from './../processor/ivprogProcessor';
 import { LanguageService } from '../services/languageService';
 
-var block_render = false;
+window.block_render = false;
 
 export function renderAlgorithm () {
-	if (block_render) {
+	if (window.block_render) {
 		return;
 	}
-	block_render = true;
+	window.block_render = true;
 
  	$('.all_functions').children().off();
 	$('.all_functions').empty();
@@ -35,5 +35,5 @@ export function renderAlgorithm () {
 		GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
 	}	
 
-	setTimeout(function(){ block_render = false; }, 500);
+	setTimeout(function(){ window.block_render = false; }, 500);
 }

+ 1 - 1
js/visualUI/commands/writer.js

@@ -77,7 +77,7 @@ function addHandlers (command, function_obj, writer_dom) {
 	    handle: '.ellipsis',
 	    animation: 100,
 	    ghostClass: 'ghost',
-	    group: 'writer',
+	    group: 'writer_' + Math.floor(Math.random() * 10000000),
 	    draggable: '.div_parent_handler',
 	    onEnd: function (evt) {
 	    	

+ 1 - 3
js/visualUI/functions.js

@@ -535,8 +535,6 @@ $( document ).ready(function() {
     }
   });
 
-  renderAlgorithm();
-
 });
 
 function updateSequenceParameters (oldIndex, newIndex, function_obj) {
@@ -577,7 +575,7 @@ function runCodeAssessment () {
     } else {
       is_iassign = false;
     }
-  }).catch( err => domConsole.err(err.message));
+  }).catch( err => console.log(err));
   
 }