Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 4f0cd08

Browse files
committed
Fix: Do not fail for non-runestone builds of ptx
1 parent 8ab84af commit 4f0cd08

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

runestone/webwork/js/webwork.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
122122
function 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

128134
function 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

137149
async function getScores(sid, wwId) {

0 commit comments

Comments
 (0)