Skip to content

Commit

Permalink
updated checkTimeElapsed function
Browse files Browse the repository at this point in the history
  • Loading branch information
d19fe8 committed Jul 5, 2017
1 parent 5433353 commit 46f1759
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 108 deletions.
82 changes: 47 additions & 35 deletions HTML/Assets/Detectors/Lumilo/Critical_Struggle/critical_struggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,51 +335,63 @@ function secondsSince(initTime){
function checkTimeElapsed(initTime) {
var timeDiff = secondsSince(initTime);
var currTimeMessage = detector_output.value.split(',')[1];
if( timeDiff > (300-seedTime) && currTimeMessage!=" > 5 min"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 5 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
console.log(currTimeMessage);
if( timeDiff > (300-seedTime)){
if (currTimeMessage!=" > 5 min"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 5 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (120-seedTime) && currTimeMessage!=" > 2 min"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 2 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (120-seedTime)){
if (currTimeMessage!=" > 2 min"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 2 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (60-seedTime) && currTimeMessage!=" > 1 min"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 1 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (60-seedTime)){
if (currTimeMessage!=" > 1 min"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 1 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (45-seedTime) && currTimeMessage!=" > 45 s"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 45 s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (45-seedTime)){
if (currTimeMessage!=" > 45 s"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > 45 s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else{
if(currTimeMessage!=" > " + seedTime.toString() + " s")
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > " + seedTime.toString() + " s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
console.log(currTimeMessage == " > " + seedTime.toString() + " s");
if(currTimeMessage!=" > " + seedTime.toString() + " s"){
detector_output.history = JSON.stringify([attemptWindow, skillLevelsAttempts, initTime, onboardSkills]);
detector_output.value = "1, > " + seedTime.toString() + " s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
}




function receive_transaction( e ){
//e is the data of the transaction from mailer from transaction assembler

Expand Down
84 changes: 48 additions & 36 deletions HTML/Assets/Detectors/Lumilo/Struggle/struggle__moving_average.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,50 +40,62 @@ function secondsSince(initTime){
function checkTimeElapsed(initTime) {
var timeDiff = secondsSince(initTime);
var currTimeMessage = detector_output.value.split(',')[1];
if( timeDiff > (300-seedTime) && currTimeMessage!=" > 5 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 5 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
console.log(currTimeMessage);
if( timeDiff > (300-seedTime)){
if (currTimeMessage!=" > 5 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 5 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (120-seedTime) && currTimeMessage!=" > 2 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 2 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (120-seedTime)){
if (currTimeMessage!=" > 2 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 2 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (60-seedTime) && currTimeMessage!=" > 1 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 1 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (60-seedTime)){
if (currTimeMessage!=" > 1 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 1 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (45-seedTime) && currTimeMessage!=" > 45 s"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 45 s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (45-seedTime)){
if (currTimeMessage!=" > 45 s"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 45 s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else{
if(currTimeMessage!=" > " + seedTime.toString() + " s")
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > " + seedTime.toString() + " s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
console.log(currTimeMessage == " > " + seedTime.toString() + " s");
if(currTimeMessage!=" > " + seedTime.toString() + " s"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > " + seedTime.toString() + " s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
}



function receive_transaction( e ){
//e is the data of the transaction from mailer from transaction assembler

Expand Down Expand Up @@ -114,7 +126,7 @@ function receive_transaction( e ){

//set conditions under which detector should update
//external state and history
if(e.data.actor == 'student' && e.data.tool_data.action != "UpdateVariable"){
if(e.data.actor == 'student' && e.data.tool_data.selection !="done" && e.data.tool_data.action != "UpdateVariable"){
detector_output.time = new Date();
detector_output.transaction_id = e.data.transaction_id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ function is_first_attempt(e){
function receive_transaction( e ){
//e is the data of the transaction from mailer from transaction assembler

isFirstAttempt = is_first_attempt(e);
if(e.data.actor == 'student' && e.data.tool_data.selection !="done" && e.data.tool_data.action != "UpdateVariable"){
isFirstAttempt = is_first_attempt(e);
}

//set conditions under which transaction should be processed
//(i.e., to update internal state and history, without
Expand Down
83 changes: 47 additions & 36 deletions HTML/Assets/Detectors/Lumilo/System_Misuse/system_misuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,57 @@ function secondsSince(initTime){
function checkTimeElapsed(initTime) {
var timeDiff = secondsSince(initTime);
var currTimeMessage = detector_output.value.split(',')[1];
if( timeDiff > (300-seedTime) && currTimeMessage!=" > 5 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 5 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
console.log(currTimeMessage);
if( timeDiff > (300-seedTime)){
if (currTimeMessage!=" > 5 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 5 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (120-seedTime) && currTimeMessage!=" > 2 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 2 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (120-seedTime)){
if (currTimeMessage!=" > 2 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 2 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (60-seedTime) && currTimeMessage!=" > 1 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 1 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (60-seedTime)){
if (currTimeMessage!=" > 1 min"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 1 min, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else if( timeDiff > (45-seedTime) && currTimeMessage!=" > 45 s"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 45 s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
else if( timeDiff > (45-seedTime)){
if (currTimeMessage!=" > 45 s"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > 45 s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
else{
if(currTimeMessage!=" > " + seedTime.toString() + " s")
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > " + seedTime.toString() + " s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
console.log(currTimeMessage == " > " + seedTime.toString() + " s");
if(currTimeMessage!=" > " + seedTime.toString() + " s"){
detector_output.history = JSON.stringify([attemptWindow, initTime]);
detector_output.value = "1, > " + seedTime.toString() + " s, " + elaborationString;
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output);
}
}
}

Expand Down Expand Up @@ -386,7 +397,7 @@ function receive_transaction( e ){

//set conditions under which detector should update
//external state and history
if(e.data.actor == 'student' && e.data.tool_data.action != "UpdateVariable"){
if(e.data.actor == 'student' && e.data.tool_data.selection !="done" && e.data.tool_data.action != "UpdateVariable"){
detector_output.time = new Date();
detector_output.transaction_id = e.data.transaction_id;

Expand Down

0 comments on commit 46f1759

Please sign in to comment.