Commit 0e088eef authored by Cody Ede (cme527)'s avatar Cody Ede (cme527)
Browse files

SomeThings are working

parent c2565953
......@@ -21,6 +21,8 @@ BlindTrial.prototype.start = function() {
this.experiment.instructions.Text = (Strings['side-instructions-blind']);
this.startTimestamp = +moment();
var count = 0;
var correct = 0;
this.handleItemClick = function(data) {
StudyLogger.logEvent({type: 'event.endtrial',
......@@ -42,6 +44,10 @@ BlindTrial.prototype.start = function() {
// this.experiment.fastTapMenu.addItemClickedCB(this.handleItemClick);
this.ShortCutPerformed = function(keyPress) {
count++;
if(keyPress.value == this.stimulus.value){
correct ++;
}
this.experiment.fastTapMenu.logPressEvent(keyPress.value);
StudyLogger.logEvent({type: 'event.endtrial',
......@@ -55,6 +61,8 @@ BlindTrial.prototype.start = function() {
this.experiment.kbManager.removeShortcutPerformedCB(this.ShortCutPerformed);
this.completed = true;
console.log(correct/count*100);
}.bind(this);
this.experiment.kbManager.addShortcutPerformedCB(this.ShortCutPerformed);
......@@ -62,7 +70,7 @@ this.experiment.kbManager.addShortcutPerformedCB(this.ShortCutPerformed);
StudyLogger.logEvent({type: 'event.starttrial',
trialtype: this.type,
trialid: this.trialid,
blockid: this.blockid,
blockid: this.blockid,
stimulus: this.stimulus});
};
......
......@@ -117,6 +117,33 @@ function Experiment(options) {
this.setTrial(this.curTrial);
}
var index = 0;
var countArr = [];
var correctTotal = 0;
var correctArr = [];
Experiment.prototype.tempLog = function(count, correct) {
if(count > 0){
countArr.push(count);
}
correctArr.push(correct);
console.log(correctArr[index]);
index++;
if(countArr.length == 16){
for (var i = 0; i < correctArr.length; i++) {
correctTotal += correctArr[i];
};
console.log(correctTotal/correctArr.length*100);
}
};
Experiment.prototype.generateTrials = function(seed) {
// Abstract, specified in subclasses
......
......@@ -115,8 +115,9 @@ LearningExperiment.prototype.generateTrials = function(seed) {
trials.push(new DoneTrial(this, {
message: Strings['experiment-complete']
}));
}));
Experiment.prototype.tempLog(0,0);
return trials;
};
......
......@@ -4,7 +4,7 @@ var DIALOG_COLOR = 0xffffff;
function ModalDialog() {
this.view = new PIXI.Container();
this.width = 1460;
this.width = 1600;
this.height = 810;
this.dialogBox = new PIXI.Graphics();
......
......@@ -22,6 +22,9 @@ TrainTrial.prototype.start = function() {
this.experiment.instructions.Text = (Strings["side-instructions-train"]);
this.startTimestamp = +moment();
var count = 0;
var correct = 0;
this.handleItemClick = function(data) {
this.experiment.fastTapMenu.flashAround(data);
......@@ -50,6 +53,8 @@ TrainTrial.prototype.start = function() {
this.ShortCutPerformed = function(keyPress) {
this.experiment.fastTapMenu.menuOpen = false;
this.experiment.fastTapMenu.flashAround(undefined,keyPress.value);
this.experiment.fastTapMenu.logPressEvent(keyPress.value);
......@@ -58,6 +63,8 @@ this.ShortCutPerformed = function(keyPress) {
{
// This will advance to the next Trail Round when keyPress matches
// the stimulus
count++;
correct++;
StudyLogger.logEvent({type: 'event.endtrial',
trialtype: this.type,
trialid: this.trialid,
......@@ -68,6 +75,7 @@ this.ShortCutPerformed = function(keyPress) {
this.experiment.kbManager.removeShortcutPerformedCB(this.ShortCutPerformed);
this.completed = true;
}
this.experiment.tempLog(count,correct);
}.bind(this);
this.experiment.kbManager.addShortcutPerformedCB(this.ShortCutPerformed);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment