Skip to content

Commit

Permalink
added student_doing_well__moving_average
Browse files Browse the repository at this point in the history
  • Loading branch information
d19fe8 committed Jun 19, 2017
1 parent aa6f0fe commit 9826616
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
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 = 6;
var attemptWindow = Array.apply(null, Array(windowSize)).map(Number.prototype.valueOf,0);


function receive_transaction( e ){
//e is the data of the transaction from mailer from transaction assembler
Expand All @@ -37,15 +42,11 @@ function receive_transaction( e ){
detector_output.step_id = e.data.tutor_data.step_id;

//custom processing (insert code here)
//
//
//
//
//
var booleanValues = [0, 1];
detector_output.value = String(booleanValues[Math.floor(Math.random() * booleanValues.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 +56,12 @@ function receive_transaction( e ){
detector_output.transaction_id = e.data.transaction_id;

//custom processing (insert code here)
//
//
//
//
//
if (sumCorrect >= threshold){
detector_output.value = "1";
}
else{
detector_output.value = "0";
}

mailer.postMessage(detector_output);
postMessage(detector_output);
Expand Down
7 changes: 6 additions & 1 deletion HTML/Assets/transaction_mailer_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ TransactionMailerUsers =
mailerURL: "mail-worker.js",
mailer: null,
mailerPort: null,
scripts: ["Detectors/Lumilo/idle.js", "Detectors/Lumilo/system_misuse.js", "Detectors/Lumilo/struggle.js", "Detectors/Lumilo/student_doing_well.js", "Detectors/Lumilo/critical_struggle.js", "Detectors/Lumilo/invisible_hand_raise.js"],
scripts: ["Detectors/Lumilo/idle.js",
"Detectors/Lumilo/system_misuse.js",
"Detectors/Lumilo/struggle.js",
"Detectors/Lumilo/student_doing_well__moving_average.js",
"Detectors/Lumilo/critical_struggle.js",
"Detectors/Lumilo/invisible_hand_raise.js"],
active: []
};

Expand Down

0 comments on commit 9826616

Please sign in to comment.