@@ -470,8 +470,8 @@ export class ActiveCode extends RunestoneBase {
470470 if ( ! didAgree ) {
471471 didAgree = confirm (
472472 "Pair Programming should only be used with the consent of your instructor." +
473- "Your partner must be a registered member of the class and have agreed to pair with you." +
474- "By clicking OK you certify that both of these conditions have been met."
473+ "Your partner must be a registered member of the class and have agreed to pair with you." +
474+ "By clicking OK you certify that both of these conditions have been met."
475475 ) ;
476476 if ( didAgree ) {
477477 localStorage . setItem ( "partnerAgree" , "true" ) ;
@@ -514,13 +514,13 @@ export class ActiveCode extends RunestoneBase {
514514 $ ( butt ) . attr (
515515 "href" ,
516516 "http://" +
517- chatcodesServer +
518- "/new?" +
519- $ . param ( {
520- topic : window . location . host + "-" + this . divid ,
521- code : this . editor . getValue ( ) ,
522- lang : "Python" ,
523- } )
517+ chatcodesServer +
518+ "/new?" +
519+ $ . param ( {
520+ topic : window . location . host + "-" + this . divid ,
521+ code : this . editor . getValue ( ) ,
522+ lang : "Python" ,
523+ } )
524524 ) ;
525525 this . chatButton = butt ;
526526 chatBar . appendChild ( butt ) ;
@@ -574,14 +574,18 @@ export class ActiveCode extends RunestoneBase {
574574 // If this is timed and already taken we should restore history info
575575 this . renderScrubber ( ) ;
576576 } else {
577- let request = new Request ( eBookConfig . ajaxURL + " gethist.json ", {
577+ let request = new Request ( "/assessment/ gethist", {
578578 method : "POST" ,
579579 headers : this . jsonHeaders ,
580580 body : JSON . stringify ( reqData ) ,
581581 } ) ;
582582 try {
583583 response = await fetch ( request ) ;
584584 let data = await response . json ( ) ;
585+ if ( ! response . ok ) {
586+ throw new Error ( `Failed to get the history data: ${ data . detail } ` ) ;
587+ }
588+ data = data . detail ;
585589 if ( data . history !== undefined ) {
586590 this . history = this . history . concat ( data . history ) ;
587591 for ( let t in data . timestamps ) {
@@ -591,7 +595,7 @@ export class ActiveCode extends RunestoneBase {
591595 }
592596 }
593597 } catch ( e ) {
594- console . log ( " unable to fetch history" ) ;
598+ console . log ( ` unable to fetch history: ${ e } ` ) ;
595599 }
596600 this . renderScrubber ( pos_last ) ;
597601 }
@@ -907,7 +911,7 @@ export class ActiveCode extends RunestoneBase {
907911 } ) ;
908912 }
909913
910- toggleEditorVisibility ( ) { }
914+ toggleEditorVisibility ( ) { }
911915
912916 addErrorMessage ( err ) {
913917 // Add the error message
@@ -1045,7 +1049,7 @@ Yet another is that there is an internal error. The internal error message is:
10451049 var xl = eval ( x ) ;
10461050 xl = xl . map ( pyStr ) ;
10471051 x = xl . join ( " " ) ;
1048- } catch ( err ) { }
1052+ } catch ( err ) { }
10491053 }
10501054 }
10511055 $ ( this . output ) . css ( "visibility" , "visible" ) ;
@@ -1149,7 +1153,7 @@ Yet another is that there is an internal error. The internal error message is:
11491153 if (
11501154 this . historyScrubber &&
11511155 this . history [ $ ( this . historyScrubber ) . slider ( "value" ) ] !=
1152- this . editor . getValue ( )
1156+ this . editor . getValue ( )
11531157 ) {
11541158 saveCode = "True" ;
11551159 this . history . push ( this . editor . getValue ( ) ) ;
0 commit comments