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

Commit 0e1fec2

Browse files
committed
Fix: voteNum message
1 parent 5d3ffab commit 0e1fec2

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

static/js/peer.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function connect(event) {
5555
if (typeof currAnswer === "undefined") {
5656
messarea.innerHTML = `<h3>You have not answered the question</h3><p>You will not be able to participate in any discussion unless you answer the question.</p>`;
5757
} else {
58-
if (voteNum < 2) {
58+
if (getVoteNum() < 2) {
5959
messarea.innerHTML = `<h3>Please Give an explanation for your answer</h3><p>Then discuss your answer with your group members</p>`;
6060
} else {
6161
messarea.innerHTML = `<h3>Voting for this question is complete</h3>`;
@@ -141,6 +141,16 @@ function connect(event) {
141141
};
142142
}
143143

144+
function getVoteNum() {
145+
if (typeof voteNum !== "undefined") {
146+
return voteNum;
147+
} else if (typeof studentVoteCount !== "undefined") {
148+
return studentVoteCount;
149+
} else {
150+
throw "Both voteNum and studentVoteCount are undefined";
151+
}
152+
}
153+
144154
function answerToString(currAnswer) {
145155
const ordA = 65;
146156
if (currAnswer.indexOf(",") > -1) {

views/peer/peer_question.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ <h2>Peer Instruction: {{=assignment_name}}</h2>
6161
var currentQuestion = '{{=XML(current_question.name)}}';
6262
document.addEventListener("DOMContentLoaded", function (event) {
6363
setTimeout(connect, 1000);
64-
window.mcList[currentQuestion].submitButton.innerHTML = "Submit";
64+
setTimeout(function () {
65+
window.mcList[currentQuestion].submitButton.innerHTML = "Submit";
66+
}, 1000);
6567
});
6668
var studentVoteCount = 1;
6769
</script>

0 commit comments

Comments
 (0)