@@ -111,7 +111,7 @@ function enterGradingMode() {
111111}
112112
113113
114- // returns a curried function !
114+ // returns a closure !
115115function genTestResultHandler ( idx ) {
116116 function ret ( res ) {
117117 assert ( testResults [ idx ] === null ) ;
@@ -131,6 +131,19 @@ function genTestResultHandler(idx) {
131131 return ret ;
132132}
133133
134+ function genDebugLinkHandler ( testResult ) {
135+ function ret ( ) {
136+ //console.log('DEBUG', testResult);
137+
138+ // TODO: switch back to visualize mode, populating all the edit
139+ // fields with the input and outputs from the failing test input
140+ // but keeping the user's submitted solution code unchanged
141+
142+ return false ; // don't reload the page
143+ }
144+ return ret ;
145+ }
146+
134147
135148function finishQuestionsInit ( questionsDat ) {
136149 $ ( "#ProblemName" ) . html ( questionsDat . name ) ;
@@ -267,9 +280,15 @@ function readyToGradeSubmission() {
267280 }
268281 else {
269282 var sadFaceImg = '<img style="vertical-align: middle; margin-right: 4px;" src="red-sad-face.jpg"/>' ;
270- var debugMeSpan = ' <span><a href="#">Debug me</a></span>' ;
283+
284+ // set its ID to 'debug_test_$i'
285+ var linkID = 'debug_test_' + i ;
286+ var debugMeSpan = ' <span><a href="#" id="' + linkID + '">Debug me</a></span>' ;
271287
272288 $ ( "#gradeMatrix tr.gradeMatrixRow:last" ) . append ( '<td>' + sadFaceImg + debugMeSpan + '</td>' ) ;
289+
290+ $ ( '#' + linkID ) . unbind ( ) ; // unbind it just to be paranoid
291+ $ ( '#' + linkID ) . click ( genDebugLinkHandler ( res ) ) ;
273292 }
274293 }
275294
0 commit comments