Skip to content

Commit

Permalink
added struggle__moving_average
Browse files Browse the repository at this point in the history
  • Loading branch information
d19fe8 committed Jun 19, 2017
1 parent 9826616 commit 4d704e8
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 19 deletions.
4 changes: 2 additions & 2 deletions HTML/Assets/Detectors/Lumilo/critical_struggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function frustrated_for_a_while(){
}

function confused_for_a_while(){

}

function many_incorrects_on_current_problem(){
Expand Down Expand Up @@ -119,7 +119,7 @@ self.onmessage = function ( e ) {
//
//
//
detectorForget = true;
detectorForget = false;

if (detectorForget){
detector_output.history = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ var mailer;

//initialize any custom global variables for this detector here
var prevStep = ""
var attemptCorrect;
var windowSize = 7;
var threshold = 1;
var attemptWindow = Array.apply(null, Array(windowSize)).map(Number.prototype.valueOf,1);
var timerId; var timerId2; var timerId3; var timerId4; var timerId5;

function receive_transaction( e ){
//e is the data of the transaction from mailer from transaction assembler
Expand All @@ -38,14 +43,12 @@ function receive_transaction( e ){

//custom processing (insert code here)
//
//
//
//
//
var booleanValues = [0, 1];
var timeValues = ["> 25 s", "> 45 s", "> 1 min", "> 2 min", "> 5 min"];
detector_output.value = String(booleanValues[Math.floor(Math.random() * booleanValues.length)]) + "," + String(timeValues[Math.floor(Math.random() * timeValues.length)]) ;

attemptCorrect = (e.data.tutor_data.action_evaluation.toLowerCase() == "correct") ? 1 : 0;
attemptWindow.shift();
attemptWindow.push(attemptCorrect);
var sumCorrect = attemptWindow.reduce(function(pv, cv) { return pv + cv; }, 0);
console.log(attemptWindow);

}

//set conditions under which detector should update
Expand All @@ -55,11 +58,59 @@ function receive_transaction( e ){
detector_output.transaction_id = e.data.transaction_id;

//custom processing (insert code here)
//
//
//
//
//
if (detector_output.value=="0, > 0 s" && (sumCorrect <= threshold)){
detector_output.history = e.data.tool_data.tool_event_time
detector_output.value = "1, > 25 s"
detector_output.time = new Date();

timerId = setTimeout(function() {
detector_output.history = e.data.tool_data.tool_event_time
detector_output.value = "1, > 45 s"
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output); },
20000)
timerId2 = setTimeout(function() {
detector_output.history = e.data.tool_data.tool_event_time
detector_output.value = "1, > 1 min"
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output); },
35000)
timerId3 = setTimeout(function() {
detector_output.history = e.data.tool_data.tool_event_time
detector_output.value = "1, > 2 min"
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output); },
95000)
timerId4 = setTimeout(function() {
detector_output.history = e.data.tool_data.tool_event_time
detector_output.value = "1, > 5 min"
detector_output.time = new Date();
mailer.postMessage(detector_output);
postMessage(detector_output);
console.log("output_data = ", detector_output); },
275000)

}
else if (detector_output.value!="0, > 0 s" && (sumCorrect <= threshold)){
detector_output.history = e.data.tool_data.tool_event_time;
detector_output.time = new Date();
}
else{
detector_output.value = "0, > 0 s";
detector_output.history = e.data.tool_data.tool_event_time
detector_output.time = new Date();

clearTimeout(timerId);
clearTimeout(timerId2);
clearTimeout(timerId3);
clearTimeout(timerId4);
}

mailer.postMessage(detector_output);
postMessage(detector_output);
Expand Down Expand Up @@ -92,7 +143,7 @@ self.onmessage = function ( e ) {
//
//
//
detectorForget = true;
detectorForget = false;

if (detectorForget){
detector_output.history = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ self.onmessage = function ( e ) {
//
//
//
detectorForget = true;
detectorForget = false;

if (detectorForget){
detector_output.history = "";
Expand Down
24 changes: 23 additions & 1 deletion HTML/Assets/Detectors/Lumilo/system_misuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@ var mailer;

//initialize any custom global variables for this detector here
var prevStep = ""
var windowSize = 15;
var gamingThreshold = 5;
var hintAbuseThreshold = 5;
var attemptWindow = Array.apply(null, Array(windowSize)).map(Number.prototype.valueOf,0);

function frequent_gaming(){

}

function frequent_hint_abuse(){

}

function hint_abuse_detector(){

}

function cognitive_gaming_detector(){

}



function receive_transaction( e ){
//e is the data of the transaction from mailer from transaction assembler
Expand Down Expand Up @@ -91,7 +113,7 @@ self.onmessage = function ( e ) {
//
//
//
detectorForget = true;
detectorForget = false;

if (detectorForget){
detector_output.history = "";
Expand Down
2 changes: 1 addition & 1 deletion HTML/Assets/transaction_mailer_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TransactionMailerUsers =
mailerPort: null,
scripts: ["Detectors/Lumilo/idle.js",
"Detectors/Lumilo/system_misuse.js",
"Detectors/Lumilo/struggle.js",
"Detectors/Lumilo/struggle__moving_average.js",
"Detectors/Lumilo/student_doing_well__moving_average.js",
"Detectors/Lumilo/critical_struggle.js",
"Detectors/Lumilo/invisible_hand_raise.js"],
Expand Down

0 comments on commit 4d704e8

Please sign in to comment.