summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/problem_list.js20
-rw-r--r--js/codeq/prolog.js7
-rw-r--r--js/codeq/python.js7
-rw-r--r--js/codeq/robot.js7
4 files changed, 20 insertions, 21 deletions
diff --git a/js/codeq/problem_list.js b/js/codeq/problem_list.js
index 9c19852..268276f 100644
--- a/js/codeq/problem_list.js
+++ b/js/codeq/problem_list.js
@@ -384,7 +384,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
});
},
- loadProblemData = function(ref, data){
+ loadProblemData = function (ref, data) {
var language = data.language;
return codeq.wait(
Q.all([
@@ -392,16 +392,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
getProblemData(language, ref.g, ref.p) // the (cached) result of processProblemData()
])
.spread(function (userProblemData, generalProblemData) {
- //codeq.log.debug("spread");
- if (userProblemData.code !== 0) throw new Error('Failed to obtain user problem data, code: ' + userProblemData.code + ', message: ' + userProblemData.message);
- if (!generalProblemData) throw new Error('General problem data is not defined');
- //codeq.globalStateMachine.transition(language, generalProblemData, data.commonDef, userProblemData.data.solution);
- return {"generalProblemData":generalProblemData,"solution":userProblemData.data.solution};
+ if (userProblemData.code !== 0) {
+ throw new Error('Failed to obtain user problem data: ' + userProblemData.message);
+ }
+ if (!generalProblemData) {
+ throw new Error('General problem data is not defined.');
+ }
+ return {
+ 'generalProblemData': generalProblemData,
+ 'solution': userProblemData.data.solution
+ };
})
);
- //while(!generalProblemData1){}
- //return [generalProblemData1, userProblemDataSolution];
- //codeq.log.debug("after wait:"+a);
},
currentLanguage; // the currently active language
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index 18e3fdd..1be339f 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -33,16 +33,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
navigationProlog.addClass("active");
navigationProlog.css('display', '');
- jqScreen.css('display', '');//we have to show the screen now so the code editor shows its initial values correctly
+ jqScreen.css('display', ''); // we have to show the screen now so the code editor shows its initial values correctly
prologHandler = createPrologHandler(problemDef, commonDef, currentSolution);
};
codeq.globalStateMachine.register('prolog', {
'jqScreen': jqScreen,
'enter': function (ref, data) {
- codeq.loadProblemData(ref,data).then(function(problem){
- //codeq.log.debug("then:"+JSON.stringify(problem));
- enterFun(problem.generalProblemData,data.commonDef,problem.solution);
+ codeq.loadProblemData(ref, data).then(function (problem) {
+ enterFun(problem.generalProblemData, data.commonDef, problem.solution);
})
.fail(function (reason) {
codeq.log.error('Failed to obtain the problem definition: ' + reason, reason);
diff --git a/js/codeq/python.js b/js/codeq/python.js
index 05821e1..9fc34c8 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
navigationPhython.addClass("active");
navigationPhython.css('display', '');
- jqScreen.css('display', '');//we have to show the screen now so the code editor shows its initial values correctly
+ jqScreen.css('display', ''); // we have to show the screen now so the code editor shows its initial values correctly
pythonHandler = createPythonHandler(problemDef, commonDef, currentSolution);
};
@@ -39,9 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
'jqScreen': jqScreen,
'enter': function (ref, data) {
- codeq.loadProblemData(ref,data).then(function(problem){
- //codeq.log.debug("then:"+JSON.stringify(problem));
- enterFun(problem.generalProblemData,data.commonDef,problem.solution);
+ codeq.loadProblemData(ref, data).then(function (problem) {
+ enterFun(problem.generalProblemData, data.commonDef, problem.solution);
})
.fail(function (reason) {
codeq.log.error('Failed to obtain the problem definition: ' + reason, reason);
diff --git a/js/codeq/robot.js b/js/codeq/robot.js
index 70f7c5d..4222d0b 100644
--- a/js/codeq/robot.js
+++ b/js/codeq/robot.js
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
navigationRobot.addClass("active");
navigationRobot.css('display', '');
- jqScreen.css('display', '');//we have to show the screen now so the code editor shows its initial values correctly
+ jqScreen.css('display', ''); // we have to show the screen now so the code editor shows its initial values correctly
robotHandler = createRobotHandler(problemDef, commonDef, currentSolution);
};
@@ -39,9 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
'jqScreen': jqScreen,
'enter': function (ref, data) {
- codeq.loadProblemData(ref,data).then(function(problem){
- //codeq.log.debug("then:"+JSON.stringify(problem));
- enterFun(problem.generalProblemData,data.commonDef,problem.solution);
+ codeq.loadProblemData(ref, data).then(function (problem) {
+ enterFun(problem.generalProblemData, data.commonDef, problem.solution);
})
.fail(function (reason) {
codeq.log.error('Failed to obtain the problem definition: ' + reason, reason);