@@ -217,6 +217,7 @@ export class ActiveCode extends RunestoneBase {
217217 "2px solid #b43232"
218218 ) ;
219219 this . isAnswered = true ;
220+ // the first time the student types in the write-code box
220221 this . logBookEvent ( {
221222 event : "activecode" ,
222223 act : "edit" ,
@@ -265,9 +266,7 @@ export class ActiveCode extends RunestoneBase {
265266 // The run is finished; re-enable the button.
266267 this . runButton . disabled = false ;
267268 this . runCount += 1 ;
268- if ( this . is_toggle && this . runCount == 3 ) {
269- alert ( "Help is Available Using the Toggle Question Selector" ) ;
270- }
269+ this . toggleAlert ( ) ;
271270 }
272271
273272 createControls ( ) {
@@ -281,7 +280,7 @@ export class ActiveCode extends RunestoneBase {
281280 $ ( butt ) . addClass ( "btn btn-success run-button" ) ;
282281 ctrlDiv . appendChild ( butt ) ;
283282 this . runButton = butt ;
284- console . log ( "adding click function for run" ) ;
283+ // console.log("adding click function for run");
285284 this . runButton . onclick = this . runButtonHandler . bind ( this ) ;
286285 $ ( butt ) . attr ( "type" , "button" ) ;
287286
@@ -1272,6 +1271,19 @@ Yet another is that there is an internal error. The internal error message is:
12721271 }
12731272 }
12741273
1274+ toggleAlert ( ) {
1275+ if ( this . is_toggle && this . runCount == 3 ) {
1276+ if ( this . errinfo != "success" || this . unit_results . substring ( 8 , 11 ) != 100.0 ) {
1277+ setTimeout ( function ( ) { alert ( "Help is Available Using the Toggle Question Selector! You can try the Mixed-up Question first." ) ; } , 500 ) ;
1278+ this . logBookEvent ( {
1279+ event : "togglealert" ,
1280+ act : "Help is Available Using the Toggle Question Selector" ,
1281+ div_id : this . divid ,
1282+ } )
1283+ }
1284+ }
1285+ }
1286+
12751287 /* runProg has several async elements to it.
12761288 * 1. Skulpt runs the python program asynchronously
12771289 * 2. The history is restored asynchronously
0 commit comments