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

Commit 4b986c4

Browse files
committed
New: Async peer updates
* Retitle the async page * Remind sync students to vote a second time * Remind async students to vote again before moving on.
1 parent e678603 commit 4b986c4

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

static/js/peer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ function connect(event) {
101101
studentVoteCount = 2;
102102
console.log("WARNING: resetting studentVoteCount to 2");
103103
}
104+
// set a timer to check if the student hasn't voted in 10 seconds
105+
// give them a warning.
106+
setTimeout(() => {
107+
if (studentVoteCount > 1 && !vote2done) {
108+
alert("You must vote twice! Even if want to keep your answer the same.")
109+
}
110+
}, 10000)
104111
}
105112
messarea = document.getElementById("imessage");
106113
messarea.innerHTML = `<h3>Time to make your 2nd vote</h3>`;
@@ -425,6 +432,7 @@ async function showPeerEnableVote2() {
425432
"Please Answer the question again. Even if you do not wish to change your answer. After answering click the button to go on to the next question.";
426433
$(".runestone [type=radio]").prop("checked", false);
427434
$(".runestone [type=checkbox]").prop("checked", false);
435+
studentVoteCount += 1;
428436
}
429437

430438
$(function () {

views/peer/peer_async.html

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@
88
eBookConfig.peerMOde = "async";
99
</script>
1010

11-
<h2>Peer Instruction Question (Async)</h2>
12-
<div id="imessage"></div>
11+
<h2>Peer Instruction Question (After Class)</h2>
12+
<div id="imessage">
13+
<p>This page is meant for you to use <i>after</i> the inclass peer instruction is over.
14+
<ol>
15+
<li>Answer the question as best you can.</li>
16+
<li>Then, in the space provided write a justification for your answer.</li>
17+
<li>Read the dialog between two of your peers on why they answered the question the way they did.</li>
18+
<li>Answer the question <strong>again.</strong> Even if you are not changing your answer from the first time.</li>
19+
</ol>
20+
</p>
21+
</div>
1322

1423
<div class="row">
1524
<div class="oneq col-md-6">{{=XML(current_question['htmlsrc'])}}</div>
@@ -34,7 +43,7 @@ <h4>A discussion for you to consider</h4>
3443
<form action="/peer/peer_async">
3544
<input type="hidden" name="assignment_id" value="{{=assignment_id}}" />
3645
<input type="hidden" name="question_num" value="{{=nextQnum}}" />
37-
<button type="submit">Next Question</button>
46+
<button type="submit" onclick="return checkVoteCount()">Next Question</button>
3847
</form>
3948
</div>
4049

@@ -46,9 +55,18 @@ <h4>A discussion for you to consider</h4>
4655
setTimeout(connect, 1000);
4756
});
4857
var studentVoteCount = 1;
58+
var vote2done = false;
4959
var nextQuestionNumber = {{= nextQnum}};
5060
var assignId = '{{=assignment_id}}'
5161

62+
function checkVoteCount() {
63+
if (studentVoteCount < 2) {
64+
alert("You must vote twice before moving on");
65+
return false;
66+
}
67+
return true;
68+
}
69+
5270
// this cannot happen until the event that indicates components are loaded
5371
$(document).on("runestone:login-complete", function () {
5472
logPeerEvent({

views/peer/peer_question.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,19 @@ <h2>Peer Instruction: {{=assignment_name}}</h2>
6060
<script>
6161
var user = '{{=auth.user.username}}';
6262
var currentQuestion = '{{=XML(current_question.name)}}';
63+
var vote2done = false;
6364
document.addEventListener("DOMContentLoaded", function (event) {
6465
setTimeout(connect, 1000);
6566
setTimeout(function () {
6667
window.mcList[currentQuestion].submitButton.innerHTML = "Submit";
68+
window.mcList[currentQuestion].submitButton.addEventListener(
69+
"click",
70+
function() {
71+
if (studentVoteCount == 2) {
72+
vote2done = true;
73+
}
74+
}
75+
);
6776
}, 1000);
6877
});
6978
var studentVoteCount = 1;

0 commit comments

Comments
 (0)