@@ -120,18 +120,30 @@ class WebWork extends RunestoneBase {
120120// These are functions that get called in response to webwork generated events.
121121// submitting the work, or showing an answer.
122122function logWebWork ( e , data ) {
123- let wwObj = wwList [ data . inputs_ref . problemUUID . replace ( "-ww-rs" , "" ) ]
124- wwObj . processCurrentAnswers ( data ) ;
125- wwObj . logCurrentAnswer ( ) ;
123+ if ( eBookConfig . useRunestoneServices ) {
124+ let wwObj = wwList [ data . inputs_ref . problemUUID . replace ( "-ww-rs" , "" ) ]
125+ if ( wwObj ) {
126+ wwObj . processCurrentAnswers ( data ) ;
127+ wwObj . logCurrentAnswer ( ) ;
128+ } else {
129+ console . log ( `Error: Could not find webwork object ${ data . inputs_ref . problemUUID } ` )
130+ }
131+ }
126132}
127133
128134function logShowCorrect ( e , data ) {
129- let wwObj = wwList [ data . inputs_ref . problemUUID . replace ( "-ww-rs" , "" ) ]
130- wwObj . logBookEvent ( {
131- event : "webwork" ,
132- div_id : data . inputs_ref . problemUUID ,
133- act : "show" ,
134- } ) ;
135+ if ( eBookConfig . useRunestoneServices ) {
136+ let wwObj = wwList [ data . inputs_ref . problemUUID . replace ( "-ww-rs" , "" ) ]
137+ if ( wwObj ) {
138+ wwObj . logBookEvent ( {
139+ event : "webwork" ,
140+ div_id : data . inputs_ref . problemUUID ,
141+ act : "show" ,
142+ } ) ;
143+ } else {
144+ console . log ( `Error: Could not find webwork object ${ data . inputs_ref . problemUUID } ` )
145+ }
146+ }
135147}
136148
137149async function getScores ( sid , wwId ) {
0 commit comments