Skip to content

Commit 1158f72

Browse files
committed
Don’t log an event without a div_id
1 parent 35265b1 commit 1158f72

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • bases/rsptx/interactives/runestone/common/js

bases/rsptx/interactives/runestone/common/js/pretext.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ function setupPTXEvents() {
3030
let container = btn.closest(".sagecell-sage");
3131
let codeInput = container ? container.querySelector(".sagecell_input") : null;
3232
let code = codeInput ? codeInput.textContent : "";
33-
rb.logBookEvent({ event: "sage", act: "run", div_id: container ? container.id : null });
33+
let div_id = container ? container.id : null;
34+
if (! div_id) {
35+
console.warn("Could not find container or div_id for sagecell button");
36+
return;
37+
}
38+
39+
rb.logBookEvent({ event: "sage", act: "run", div_id: div_id });
3440
});
3541
});
3642
if (typeof eBookConfig !== "undefined" && !eBookConfig.isInstructor) {

0 commit comments

Comments
 (0)