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

Commit d68fe9a

Browse files
committed
Remind students that help is available on toggle Q
1 parent c6715d9 commit d68fe9a

File tree

3 files changed

+37
-19
lines changed

3 files changed

+37
-19
lines changed

runestone/activecode/js/activecode.js

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export class ActiveCode extends RunestoneBase {
7373
this.loadButton = null;
7474
this.outerDiv = null;
7575
this.partner = "";
76+
this.runCount = 0;
7677
this.logResults = true;
7778
if (!eBookConfig.allow_pairs || $(orig).data("nopair")) {
7879
this.enablePartner = false;
@@ -254,6 +255,10 @@ export class ActiveCode extends RunestoneBase {
254255
this.renderFeedback();
255256
// The run is finished; re-enable the button.
256257
this.runButton.disabled = false;
258+
this.runCount += 1;
259+
if (this.is_toggle && this.runCount == 3) {
260+
alert("Help is Available Using the Toggle Question Selector");
261+
}
257262
}
258263

259264
createControls() {
@@ -476,8 +481,8 @@ export class ActiveCode extends RunestoneBase {
476481
if (!didAgree) {
477482
didAgree = confirm(
478483
"Pair Programming should only be used with the consent of your instructor." +
479-
"Your partner must be a registered member of the class and have agreed to pair with you." +
480-
"By clicking OK you certify that both of these conditions have been met."
484+
"Your partner must be a registered member of the class and have agreed to pair with you." +
485+
"By clicking OK you certify that both of these conditions have been met."
481486
);
482487
if (didAgree) {
483488
localStorage.setItem("partnerAgree", "true");
@@ -520,13 +525,13 @@ export class ActiveCode extends RunestoneBase {
520525
$(butt).attr(
521526
"href",
522527
"http://" +
523-
chatcodesServer +
524-
"/new?" +
525-
$.param({
526-
topic: window.location.host + "-" + this.divid,
527-
code: this.editor.getValue(),
528-
lang: "Python",
529-
})
528+
chatcodesServer +
529+
"/new?" +
530+
$.param({
531+
topic: window.location.host + "-" + this.divid,
532+
code: this.editor.getValue(),
533+
lang: "Python",
534+
})
530535
);
531536
this.chatButton = butt;
532537
chatBar.appendChild(butt);
@@ -582,16 +587,21 @@ export class ActiveCode extends RunestoneBase {
582587
// If this is timed and already taken we should restore history info
583588
this.renderScrubber();
584589
} else {
585-
let request = new Request(`${eBookConfig.new_server_prefix}/assessment/gethist`, {
586-
method: "POST",
587-
headers: this.jsonHeaders,
588-
body: JSON.stringify(reqData),
589-
});
590+
let request = new Request(
591+
`${eBookConfig.new_server_prefix}/assessment/gethist`,
592+
{
593+
method: "POST",
594+
headers: this.jsonHeaders,
595+
body: JSON.stringify(reqData),
596+
}
597+
);
590598
try {
591599
response = await fetch(request);
592600
let data = await response.json();
593601
if (!response.ok) {
594-
throw new Error(`Failed to get the history data: ${data.detail}`);
602+
throw new Error(
603+
`Failed to get the history data: ${data.detail}`
604+
);
595605
}
596606
data = data.detail;
597607
if (data.history !== undefined) {
@@ -919,7 +929,7 @@ export class ActiveCode extends RunestoneBase {
919929
});
920930
}
921931

922-
toggleEditorVisibility() { }
932+
toggleEditorVisibility() {}
923933

924934
addErrorMessage(err) {
925935
// Add the error message
@@ -1057,7 +1067,7 @@ Yet another is that there is an internal error. The internal error message is:
10571067
var xl = eval(x);
10581068
xl = xl.map(pyStr);
10591069
x = xl.join(" ");
1060-
} catch (err) { }
1070+
} catch (err) {}
10611071
}
10621072
}
10631073
$(this.output).css("visibility", "visible");
@@ -1161,7 +1171,7 @@ Yet another is that there is an internal error. The internal error message is:
11611171
if (
11621172
this.historyScrubber &&
11631173
this.history[$(this.historyScrubber).slider("value")] !=
1164-
this.editor.getValue()
1174+
this.editor.getValue()
11651175
) {
11661176
saveCode = "True";
11671177
this.history.push(this.editor.getValue());
@@ -1220,7 +1230,7 @@ Yet another is that there is an internal error. The internal error message is:
12201230
if (typeof sid !== "undefined") {
12211231
unitData.sid = sid;
12221232
}
1223-
await this.logBookEvent(unitData)
1233+
await this.logBookEvent(unitData);
12241234
}
12251235
}
12261236

runestone/common/js/runestonebase.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export default class RunestoneBase {
7171
if ($(opts.orig).data("question_label")) {
7272
this.question_label = $(opts.orig).data("question_label");
7373
}
74+
this.is_toggle = true ? opts.is_toggle : false;
75+
this.is_select = true ? opts.is_select : false;
7476
}
7577
this.jsonHeaders = new Headers({
7678
"Content-type": "application/json; charset=utf-8",

runestone/selectquestion/js/selectone.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ export default class SelectOne extends RunestoneBase {
228228
// just render this component on the page in its usual place
229229
await renderRunestoneComponent(htmlsrc, selectorId, {
230230
selector_id: selectorId,
231+
is_toggle: this.toggleOptions,
232+
is_select: true,
231233
useRunestoneServices: true,
232234
});
233235
if (data.toggleOptions) {
@@ -296,6 +298,8 @@ export default class SelectOne extends RunestoneBase {
296298
var htmlsrc = await this.getToggleSrc(selectedQuestion);
297299
renderRunestoneComponent(htmlsrc, "toggle-preview", {
298300
selector_id: "toggle-preview",
301+
is_toggle: this.toggleOptions,
302+
is_select: true,
299303
useRunestoneServices: true,
300304
});
301305

@@ -375,6 +379,8 @@ export default class SelectOne extends RunestoneBase {
375379
document.getElementById(selectorId).innerHTML = ""; // need to check whether this is even necessary
376380
await renderRunestoneComponent(htmlsrc, selectorId, {
377381
selector_id: selectorId,
382+
is_toggle: this.toggleOptions,
383+
is_select: true,
378384
useRunestoneServices: true,
379385
});
380386
let request = new Request(

0 commit comments

Comments
 (0)