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/prolog.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'js/codeq/prolog.js') diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index 2aeede4..69523b0 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -166,7 +166,7 @@ 'step': 'run', 'program': editor.getDoc().getValue(), 'query': command, - 'trace': activityHandler.addAndPurge({'typ': 'slv', 'qry': command}) + 'trace': activityHandler.addAndPurge({'typ': 'prolog_solve', 'query': command}) }, problem_id).then(tcs, tcf); } else { @@ -176,7 +176,7 @@ return codeq.comms.sendQuery({ 'problem_id': problem_id, 'step': 'next', - 'trace': activityHandler.addAndPurge({'typ': 'nxt'}) + 'trace': activityHandler.addAndPurge({'typ': 'prolog_next'}) }, problem_id).then(tcs, tcf); } else { @@ -185,10 +185,9 @@ return codeq.comms.sendQuery({ 'problem_id': problem_id, 'step': 'end', - 'trace': activityHandler.addAndPurge({'typ': 'stp'}) + 'trace': activityHandler.addAndPurge({'typ': 'prolog_end'}) }, problem_id).then(tcs, tcf); } - } }; @@ -240,6 +239,7 @@ }); jqBtnPlan.on('click', function () { + activityHandler.queueTrace({'typ': 'plan'}); if (!hinter.planNext()) { jqBtnPlan.prop('disabled', true).blur(); } @@ -255,6 +255,7 @@ }) .then(function (data) { if (data.code === 0) { + activityHandler.queueTrace({'typ': 'hint', 'feedback': data.hints}); hinter.handle(data.hints); } else { @@ -279,6 +280,7 @@ }) .then(function (data) { if (data.code === 0) { + activityHandler.queueTrace({'typ': 'test', 'feedback': data.hints}); hinter.handle(data.hints); } else { @@ -294,6 +296,7 @@ }); codeq.comms.loadProblem(problemDef.id).done(); + activityHandler.queueTrace({'typ': 'open', 'time': Date.now()}); return { destroy: function () { @@ -301,6 +304,7 @@ $('#screen_prolog .title').text('');//empty the title text jqAllButtons.off(); editor.off('change'); + activityHandler.queueTrace({'typ': 'close'}); activityHandler.flush(); hinter.destroy(); terminal.destroy(); -- cgit v1.2.1