From d2150cf0ed43abc8e496e9a95013028325057976 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 5 Oct 2015 17:37:49 +0200 Subject: Record all user activity in trace New generic actions: open(time), close plan hint(feedback), test(feedback) New Prolog actions: prolog_solve(query), prolog_next, prolog_end New Python actions: python_run(program), python_stop, python_input(text) New robot actions: robot_run(program), robot_stop(program) --- js/codeq/python.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/codeq/python.js') diff --git a/js/codeq/python.js b/js/codeq/python.js index 4d6ace3..236d947 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -139,6 +139,7 @@ terminal.onInput = function (text) { terminal.leftmostCol = 0; + activityHandler.queueTrace({'typ': 'python_input', 'txt': text + '\n'}); return codeq.comms.sendPythonPush({ 'text': text + '\n' }).then(tcs, tcf); @@ -198,6 +199,7 @@ }); jqBtnPlan.on('click', function () { + activityHandler.queueTrace({'typ': 'plan'}); if (!hinter.planNext()) { jqBtnPlan.prop('disabled', true).blur(); } @@ -211,6 +213,7 @@ }) .then(function (data) { if (data.code === 0) { + activityHandler.queueTrace({'typ': 'hint', 'feedback': data.hints}); hinter.handle(data.hints); } else { @@ -229,6 +232,7 @@ }) .then(function (data) { if (data.code === 0) { + activityHandler.queueTrace({'typ': 'test', 'feedback': data.hints}); hinter.handle(data.hints); } else { @@ -240,6 +244,7 @@ }); jqBtnRun.on('click', function () { var program = editor.getDoc().getValue(); + activityHandler.queueTrace({'typ': 'python_run', 'program': program}); codeq.comms.sendPythonStop({}) .then(function () { codeq.comms.sendPythonExec({ @@ -252,12 +257,14 @@ jqTerminal.click(); }); jqBtnStop.on('click', function () { + activityHandler.queueTrace({'typ': 'python_stop'}); codeq.comms.sendPythonStop({}) .fail(commError) .done(); }); codeq.comms.loadProblem(problemDef.id).done(); + activityHandler.queueTrace({'typ': 'open', 'time': Date.now()}); return { destroy: function () { @@ -266,6 +273,7 @@ jqAllButtons.off(); editor.off('change'); codeq.comms.off('terminal_output'); // stop listening for the terminal events from server + activityHandler.queueTrace({'typ': 'close'}); activityHandler.flush(); hinter.destroy(); terminal.destroy(); -- cgit v1.2.1