Skip to content

Commit

Permalink
added asterisk to identify steps not correct on first attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
d19fe8 committed Jul 13, 2017
1 parent 35ecbce commit 5edcfd6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions HTML/Assets/Detectors/Lumilo/current_problem_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,22 @@ var currRight = "_______";
var runningSolution = "";
var solutionStages = "";
var runningSolutionMinusCurrentLine = "";
var stepCounter = {};
//
//
//
function reinsertParentheses(e){

var a = '20eq5parx-1par'.split("par");
var returnString = "";
var parenList = ['(',')'];
for(var i = 0; i < a.length-1; i++){
returnString += a[i] + parenList[i%2];
}
returnString += a[a.length-1];

return returnString;
}

function receive_transaction( e ){
//e is the data of the transaction from mailer from transaction assembler
Expand All @@ -59,6 +72,19 @@ function receive_transaction( e ){
detector_output.step_id = e.data.tutor_data.step_id;

//custom processing (insert code here)
//
//

//
var currStep = e.data.tutor_data.selection;
if(currStep in stepCounter){
stepCounter[currStep] += 1;
}
else{
stepCounter[currStep] = 1;
}


//
if (e.data.tool_data.selection.includes("solve")){

Expand All @@ -80,12 +106,22 @@ function receive_transaction( e ){
if (e.data.tutor_data.action_evaluation.toLowerCase() == "incorrect"){
currLeft = "[" + currLeft + "]";
}
else{
if(stepCounter[currStep] != 1){
currLeft = currLeft + "*";
}
}
}
if (e.data.tool_data.selection.includes("solveRight")){
currRight = e.data.tool_data.input;
if (e.data.tutor_data.action_evaluation.toLowerCase() == "incorrect"){
currRight = "[" + currRight + "]";
}
else{
if(stepCounter[currStep] != 1){
currRight = currRight + "*";
}
}
}

if (e.data.tool_data.selection.includes(String(currRow))){
Expand All @@ -95,6 +131,9 @@ function receive_transaction( e ){
//would be ideal to change this to something more robust... specifically:
//would be nice if we could access varables from tutor state (variable table...)
prevEq = e.data.context.problem_name.replace(" ", " + ").replace("eq", " = ").replace("+", " + ").replace("=", " = ");
if("par" in prevEq){
prevEq = reinsertParentheses(prevEq);
}
runningSolutionMinusCurrentLine = prevEq;
//"-x 6eq15"
}
Expand Down

0 comments on commit 5edcfd6

Please sign in to comment.