From 1dd4d473bb136c607eeea3a2d655b3f56e5aeee8 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 23 Feb 2016 17:31:56 +0100 Subject: Remove explicit "Hint" button Hints are now generated for each tested program, and the user can press a button to reveal the hints. --- js/codeq/python.js | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'js/codeq/python.js') diff --git a/js/codeq/python.js b/js/codeq/python.js index 10032e8..f2b0184 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -35,11 +35,10 @@ along with this program. If not, see . */ jqAllQuadrants = jqDescription.add(jqCode).add(jqConsole).add(jqInfo), // all the quadrants // buttons jqBtnPlan = jqScreen.find('.btn-plan'), - jqBtnHint = jqScreen.find('.btn-hint').ladda(), jqBtnTest = jqScreen.find('.btn-test').ladda(), jqBtnRun = jqScreen.find('.btn-run'), jqBtnStop = jqScreen.find('.btn-stop'), - jqInfoButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnTest), // all info-focusing buttons + jqInfoButtons = jqBtnPlan.add(jqBtnTest), // all info-focusing buttons jqAllButtons = jqInfoButtons.add(jqBtnRun).add(jqBtnStop), // all buttons // misc currentSubState = null, @@ -208,7 +207,7 @@ along with this program. If not, see . */ }), activityHandler = codeq.makeActivityHandler(editor, problemDef.id), terminal = makePythonTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler), - hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'python_hints', problemDef, commonDef), + hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'python_hints', problemDef, commonDef, activityHandler), commError = function (error) { alert(error); }; @@ -236,39 +235,12 @@ along with this program. If not, see . */ }); jqBtnPlan.on('click', function () { - activityHandler.queueTrace({'typ': 'plan'}); if (!hinter.planNext()) { jqBtnPlan.prop('disabled', true).blur(); } }); - jqBtnHint.on('click', function () { - editor.setOption('readOnly', true); - jqBtnTest.prop('disabled', true); - jqBtnHint.ladda('start'); - codeq.comms.sendHint({ - 'program': editor.getDoc().getValue(), - 'problem_id': problemDef.id - }) - .then(function (data) { - if (data.code === 0) { - activityHandler.queueTrace({'typ': 'hint', 'feedback': data.hints}); - hinter.handle(data.hints); - } - else { - terminal.append('error: ' + data.message); - } - }) - .fail(commError) - .fin(function () { - editor.setOption('readOnly', false); - jqBtnHint.ladda('stop'); - jqBtnTest.prop('disabled', false); - }) - .done(); - }); jqBtnTest.on('click', function () { editor.setOption('readOnly', true); - jqBtnHint.prop('disabled', true); jqBtnTest.ladda('start'); codeq.comms.sendTest({ 'program': editor.getDoc().getValue(), @@ -276,7 +248,6 @@ along with this program. If not, see . */ }) .then(function (data) { if (data.code === 0) { - activityHandler.queueTrace({'typ': 'test', 'feedback': data.hints}); hinter.handle(data.hints); } else { @@ -287,7 +258,6 @@ along with this program. If not, see . */ .fin(function () { editor.setOption('readOnly', false); jqBtnTest.ladda('stop'); - jqBtnHint.prop('disabled', false); }) .done(); }); -- cgit v1.2.1