@@ -103,7 +103,6 @@ export default class Timed extends RunestoneBase {
103103 // If a user has not taken this exam then we want to make sure
104104 // that if a question has been seen by the student before we do
105105 // not populate previous answers.
106- let response = Promise . resolve ( ) ;
107106 let sendInfo = {
108107 div_id : this . divid ,
109108 course_name : eBookConfig . course ,
@@ -118,24 +117,27 @@ export default class Timed extends RunestoneBase {
118117 body : JSON . stringify ( sendInfo ) ,
119118 }
120119 ) ;
121- response = await fetch ( request ) ;
120+ let response = await fetch ( request ) ;
122121 let data = await response . json ( ) ;
123122 this . taken = data . tookAssessment ;
124123 this . assessmentTaken = this . taken ;
125124 if ( ! this . taken ) {
126125 localStorage . clear ( ) ;
127126 }
127+ console . log ( "done with check status" ) ;
128+ return response ;
128129 } else {
129130 this . taken = false ;
130131 this . assessmentTaken = false ;
132+ return Promise . resolve ( ) ;
131133 }
132- return response ;
133134 }
134135
135136 /*===============================
136137 === Generating new Timed HTML ===
137138 ===============================*/
138139 renderTimedAssess ( ) {
140+ console . log ( "rendering timed " ) ;
139141 // create renderedQuestionArray returns a promise
140142 //
141143 this . createRenderedQuestionArray ( ) ;
@@ -153,7 +155,8 @@ export default class Timed extends RunestoneBase {
153155 // Replace intermediate HTML with rendered HTML
154156 $ ( this . origElem ) . replaceWith ( this . assessDiv ) ;
155157 // check if already taken and if so show results
156- this . tookTimedExam ( ) ; // rename to renderPossibleResults
158+ this . styleExamElements ( ) ; // rename to renderPossibleResults
159+ this . checkServer ( "timedExam" ) ;
157160 }
158161
159162 renderContainer ( ) {
@@ -234,7 +237,9 @@ export default class Timed extends RunestoneBase {
234237 } . bind ( this ) ,
235238 false
236239 ) ;
237- this . controlDiv . appendChild ( this . startBtn ) ;
240+ if ( ! this . taken ) {
241+ this . controlDiv . appendChild ( this . startBtn ) ;
242+ }
238243 if ( ! this . nopause ) {
239244 this . controlDiv . appendChild ( this . pauseBtn ) ;
240245 }
@@ -734,7 +739,8 @@ export default class Timed extends RunestoneBase {
734739 ) ;
735740 }
736741 }
737- tookTimedExam ( ) {
742+
743+ styleExamElements ( ) {
738744 // Checks if this exam has been taken before
739745 $ ( this . timerContainer ) . css ( {
740746 width : "50%" ,
@@ -758,7 +764,6 @@ export default class Timed extends RunestoneBase {
758764 "background-color" : "black" ,
759765 color : "white" ,
760766 } ) ;
761- this . checkServer ( "timedExam" ) ;
762767 }
763768
764769 finishAssessment ( ) {
0 commit comments