Skip to content

Instantly share code, notes, and snippets.

@etosch
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etosch/9241545 to your computer and use it in GitHub Desktop.
Save etosch/9241545 to your computer and use it in GitHub Desktop.
To find the time spent per question, we need to track the time between firings of showQuestion and registerAndShowNextQuestion.
var oldShowQuestion = sm.showQuestion;
var oldRegisterAndShowNextQuestion = sm.registerAndShowNextQuestion;
var addTimingInfo = function(q, tag) {
var start = document.createElement('input');
start.type='text';
start.id=tag+'_'+q.id;
start.name=tag+'_'+q.id;
start.form='mturk_form';
start.hidden=true;
start.defaultValue=new Date().getTime();
console.log(start.value);
document.getElementById('mturk_form').appendChild(start);
};
sm.showQuestion = function (q) {
addTimingInfo(q,'start');
oldShowQuestion(q);
};
sm.registerAndShowNextQuestion = function (pid,q,o){
addTimingInfo(q,'end');
oldRegisterAndShowNextQuestion(pid,q,o);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment