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

Commit b3aa324

Browse files
committed
show feedback after async 2nd vote
1 parent fe7a9c1 commit b3aa324

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

runestone/mchoice/js/mchoice.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export default class MultipleChoice extends RunestoneBase {
170170
this.randomizeAnswers();
171171
}
172172
let self = this;
173-
let answerFunc = function () {
173+
let answerFunc = function() {
174174
self.isAnswered = true;
175175
};
176176
for (var j = 0; j < this.answerList.length; j++) {
@@ -217,15 +217,15 @@ export default class MultipleChoice extends RunestoneBase {
217217
if (this.multipleanswers) {
218218
this.submitButton.addEventListener(
219219
"click",
220-
function () {
220+
function() {
221221
this.processMCMASubmission(true);
222222
}.bind(this),
223223
false
224224
);
225225
} else {
226226
this.submitButton.addEventListener(
227227
"click",
228-
function (ev) {
228+
function(ev) {
229229
ev.preventDefault();
230230
this.processMCMFSubmission(true);
231231
}.bind(this),
@@ -245,7 +245,7 @@ export default class MultipleChoice extends RunestoneBase {
245245
this.compareButton.textContent = "Compare me";
246246
this.compareButton.addEventListener(
247247
"click",
248-
function () {
248+
function() {
249249
this.compareAnswers(this.divid);
250250
}.bind(this),
251251
false
@@ -385,8 +385,15 @@ export default class MultipleChoice extends RunestoneBase {
385385
}
386386
} else {
387387
// acknowledge submission
388-
$(this.feedBackDiv).html("<p>Your Answer has been recorded</p>");
389-
$(this.feedBackDiv).attr("class", "alert alert-info");
388+
if (eBookConfig.peer &&
389+
eBookConfig.peerMode === "async" &&
390+
typeof studentVoteCount !== "undefined" &&
391+
studentVoteCount > 1) {
392+
this.renderMCMAFeedBack();
393+
} else {
394+
$(this.feedBackDiv).html("<p>Your Answer has been recorded</p>");
395+
$(this.feedBackDiv).attr("class", "alert alert-info");
396+
}
390397
}
391398
}
392399

@@ -529,9 +536,15 @@ export default class MultipleChoice extends RunestoneBase {
529536
this.enableMCComparison();
530537
}
531538
} else {
532-
// acknowledge submission
533-
$(this.feedBackDiv).html("<p>Your Answer has been recorded</p>");
534-
$(this.feedBackDiv).attr("class", "alert alert-info");
539+
if (eBookConfig.peer &&
540+
eBookConfig.peerMode === "async" &&
541+
typeof studentVoteCount !== "undefined" &&
542+
studentVoteCount > 1) {
543+
this.renderMCMAFeedBack();
544+
} else {
545+
$(this.feedBackDiv).html("<p>Your Answer has been recorded</p>");
546+
$(this.feedBackDiv).attr("class", "alert alert-info");
547+
}
535548
}
536549
}
537550

@@ -690,8 +703,8 @@ export default class MultipleChoice extends RunestoneBase {
690703
== Find the custom HTML tags and ==
691704
== execute our code on them ==
692705
=================================*/
693-
$(document).on("runestone:login-complete", function () {
694-
$("[data-component=multiplechoice]").each(function (index) {
706+
$(document).on("runestone:login-complete", function() {
707+
$("[data-component=multiplechoice]").each(function(index) {
695708
// MC
696709
var opts = {
697710
orig: this,

0 commit comments

Comments
 (0)