@@ -54,7 +54,7 @@ var helpQueueSize = 0;
5454var tutorAvailable = false ;
5555var tutorWaitText = 'Please wait for the next available tutor.' ;
5656
57- var activateSyntaxErrorSurvey = false ; // true;
57+ var activateSyntaxErrorSurvey = true ; // true;
5858
5959function setHelpQueueSizeLabel ( ) {
6060 if ( helpQueueSize == 1 ) {
@@ -273,16 +273,26 @@ function experimentalPopUpSyntaxErrorSurvey() {
273273 // need to set both max-width and width() ...
274274 $ ( bub . qTipID ( ) ) . css ( 'max-width' , '350px' ) . width ( '350px' ) ;
275275
276- $ ( bub . qTipContentID ( ) ) . html ( '<div id="syntaxErrBubbleContents"><div id="syntaxErrHeader">You just fixed the following error:</div>\
277- <div id="syntaxErrCodeDisplay"></div>\
278- <div id="syntaxErrMsg"></div>\
279- <div id="syntaxErrQuestion">\
280- If you think this message wasn\'t helpful, what would have been the ideal error message for you here?<br/>\
281- <input type="text" id="syntaxErrTxtInput" size=60 maxlength=150/><br/>\
282- <button id="syntaxErrSubmitBtn" type="button">Submit</button>\
283- <button id="syntaxErrCloseBtn" type="button">Close</button>\
284- </div></div>\
285- ' ) ;
276+ var myUuid = supports_html5_storage ( ) ? localStorage . getItem ( 'opt_uuid' ) : '' ;
277+
278+ // Wording of the survey bubble:
279+ var version = 'v1' ; // v1 - deployed on 2015-04-20
280+
281+ var surveyBubbleHTML = '<div id="syntaxErrBubbleContents">\
282+ <div id="syntaxErrHeader">You just fixed the following error:</div>\
283+ <div id="syntaxErrCodeDisplay"></div>\
284+ <div id="syntaxErrMsg"></div>\
285+ <div id="syntaxErrQuestion">\
286+ If you think this message wasn\'t helpful, what would have been the best error message for you here?<br/>\
287+ <input type="text" id="syntaxErrTxtInput" size=60 maxlength=150/><br/>\
288+ <button id="syntaxErrSubmitBtn" type="button">Submit</button>\
289+ <button id="syntaxErrCloseBtn" type="button">Close</button>\
290+ </div>\
291+ </div>'
292+
293+
294+ $ ( bub . qTipContentID ( ) ) . html ( surveyBubbleHTML ) ;
295+
286296 // unbind first, then bind a new one
287297 myVisualizer . domRoot . find ( '#pyCodeOutputDiv' )
288298 . unbind ( 'scroll' )
@@ -291,13 +301,37 @@ function experimentalPopUpSyntaxErrorSurvey() {
291301 } ) ;
292302
293303 $ ( bub . qTipContentID ( ) + ' #syntaxErrSubmitBtn' ) . click ( function ( ) {
294- console . log ( "SUBMIT!" ) ;
304+ var res = $ ( bub . qTipContentID ( ) + ' #syntaxErrTxtInput' ) . val ( ) ;
305+ var resObj = { appState : getAppState ( ) ,
306+ exc : prevExecutionExceptionObj , // note that prevExecutionExceptionObjLst is BLOWN AWAY by now
307+ opt_uuid : myUuid ,
308+ reply : res ,
309+ type : 'submit' ,
310+ v : version } ;
311+
312+ //console.log(resObj);
313+ $ . get ( 'syntax_err_survey.py' , { arg : JSON . stringify ( resObj ) } , function ( dat ) { } ) ;
314+
315+ bub . destroyQTip ( ) ;
295316 } ) ;
296317
297318 $ ( bub . qTipContentID ( ) + ' #syntaxErrCloseBtn' ) . click ( function ( ) {
319+ // grab the value anyways in case the learner wrote something decent ...
320+ var res = $ ( bub . qTipContentID ( ) + ' #syntaxErrTxtInput' ) . val ( ) ;
321+ var resObj = { appState : getAppState ( ) ,
322+ exc : prevExecutionExceptionObj , // note that prevExecutionExceptionObjLst is BLOWN AWAY by now
323+ opt_uuid : myUuid ,
324+ reply : res ,
325+ type : 'close' ,
326+ v : version } ;
327+
328+ //console.log(resObj);
329+ $ . get ( 'syntax_err_survey.py' , { arg : JSON . stringify ( resObj ) } , function ( dat ) { } ) ;
330+
298331 bub . destroyQTip ( ) ;
299332 } ) ;
300333
334+
301335 var bubbleAceEditor = ace . edit ( 'syntaxErrCodeDisplay' ) ;
302336 // set the size and value ASAP to get alignment working well ...
303337 bubbleAceEditor . setOptions ( { minLines : 1 , maxLines : 5 } ) ; // keep this SMALL
@@ -354,6 +388,17 @@ function experimentalPopUpSyntaxErrorSurvey() {
354388 bub . redrawCodelineBubble ( ) ; // do an initial redraw to align everything
355389
356390 //globalBub = bub; // for debugging
391+
392+ // log an event whenever this bubble is show (i.e., an 'impression')
393+ // NB: it might actually be hidden if it appears on a line that
394+ // isn't initially visible to the user, but whatevers ...
395+ var impressionObj = { appState : getAppState ( ) ,
396+ exceptionLst : prevExecutionExceptionObjLst ,
397+ opt_uuid : myUuid ,
398+ type : 'show' ,
399+ v : version } ;
400+ //console.log(impressionObj);
401+ $ . get ( 'syntax_err_survey.py' , { arg : JSON . stringify ( impressionObj ) } , function ( dat ) { } ) ;
357402 }
358403 }
359404}
0 commit comments