diff --git a/HTML/Assets/Detectors/Lumilo/current_problem_history.js b/HTML/Assets/Detectors/Lumilo/current_problem_history.js index 6bd3ee7..62bf7e0 100644 --- a/HTML/Assets/Detectors/Lumilo/current_problem_history.js +++ b/HTML/Assets/Detectors/Lumilo/current_problem_history.js @@ -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 @@ -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")){ @@ -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))){ @@ -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" }