Skip to content

Commit ea2187a

Browse files
authored
Merge pull request #1178 from sethbern/fix-next-question-placement
Improve async PI student user experience: step banner, button fix, and prompt update
2 parents e6e12b9 + a4f44d4 commit ea2187a

File tree

3 files changed

+79
-27
lines changed

3 files changed

+79
-27
lines changed

bases/rsptx/web2py_server/applications/runestone/controllers/peer.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ def peer_async():
724724
question_num = int(request.vars.question_num)
725725

726726
current_question, all_done = _get_numbered_question(assignment_id, question_num - 1)
727+
total_questions = len(_get_assignment_questions(assignment_id))
727728

728729
assignment = db(db.assignments.id == assignment_id).select().first()
729730

@@ -762,6 +763,8 @@ def peer_async():
762763
assignment_id=assignment_id,
763764
assignment_name=assignment.name,
764765
nextQnum=question_num + 1,
766+
total_questions=total_questions,
767+
is_last_question=(question_num >= total_questions),
765768
all_done=all_done,
766769
has_vote1=has_vote1,
767770
has_reflection=has_reflection,
@@ -929,7 +932,7 @@ def get_async_llm_reflection():
929932
"only speak in lower case.\n"
930933
"you are a student talking to another student during peer instruction.\n"
931934
"you are both looking at the same multiple choice question with code and answers.\n"
932-
"you remember the code and choices.\n"
935+
"you remember the question and choices.\n"
933936
"most messages should be short (1 to 3 sentences often very short).\n"
934937
"use casual informal language and common typos.\n"
935938
"never use commas.\n"
@@ -938,23 +941,24 @@ def get_async_llm_reflection():
938941
"do not sound like a teacher.\n"
939942
"do not explain step by step.\n"
940943
"never say something is right or wrong.\n"
941-
"your answer can shift throughout the conversation\n"
944+
"do not pretend to have picked an answer yourself.\n"
942945
"never mention a choice letter as the correct answer.\n"
943-
"never clearly describe the final result of the code.\n"
944-
"never fully state what the program prints.\n"
945-
"use common misconceptions relating to the specific problem.\n"
946-
"refer to code loosely like 'that line' or 'the loop' or 'the head' or 'the print'.\n"
946+
"if the question includes code never clearly describe the final result or fully state what it prints.\n"
947+
"if the question does not include code do not make up or reference code that is not there.\n"
948+
"only refer to what is actually in the question.\n"
949+
"be aware of common misconceptions but do not introduce them yourself.\n"
950+
"if there is code refer to it loosely like 'that line' or 'the loop' or 'the print'.\n"
947951
"often hedge with uncertainty.\n"
948-
#"never agree with the other student's interpretation even if it sounds correct.\n" #porter found when PI is adversarial students disengage
949-
"use content from the other multiple choice options in your reponses when needed\n"
950-
"let your mental model shift slightly under pressure but keep reasoning partial and never fully resolve\n"
951-
"if the other student clearly sounds confident or repeats the same answer twice stop debating and tell them to vote again or submit it.\n"
952+
"ask the other student to explain why they picked their answer and how they reasoned through it.\n"
953+
"ask follow up questions about their reasoning like 'what makes you think that' or 'how did you trace through it'.\n"
954+
"do not push them toward a different answer or imply their answer is wrong.\n"
955+
"never reveal or hint at which answer is correct or incorrect.\n"
956+
"never say things like 'the feedback says' or 'according to the answer' or reference any grading or correctness information.\n"
957+
"do not make up information that is not in the question.\n"
958+
"if you are unsure about something say so honestly instead of guessing.\n"
959+
"if the other student clearly sounds confident or repeats the same answer twice tell them to vote again or submit it.\n"
952960
"do not continue reasoning after telling them to vote again.\n"
953-
"sometimes question whether you even read the code correctly before forming an opinion.\n"
954-
"occasionally bring up a wrong answer option as if it might be right without committing to it.\n"
955-
"pick an answer choice different than the one the student selected and ask the student to explain why it cannot be correct.\n"
956-
"show reasoning process not conclusions, think out loud rather than arriving anywhere.\n"
957-
"focus on reasoning not teaching.\n\n"
961+
"focus on getting them to think through the problem not on changing their mind.\n\n"
958962
)
959963

960964
if question:

bases/rsptx/web2py_server/applications/runestone/static/js/peer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Configuration for the PI steps and helper functions to handle step progression in the instructor's interface
2-
console.log("PEER JS VERSION TEST 12345");
32
const STEP_CONFIG = {
43
vote1: {
54
next: ['makep', 'facechat', 'makeabgroups'],

bases/rsptx/web2py_server/applications/runestone/views/peer/peer_async.html

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@
3333
</div>
3434

3535
<h2>Peer Instruction Question (After Class)</h2>
36+
37+
{{ if all_done == "false": }}
38+
<div id="stepBanner" style="
39+
background: #4A9FDE;
40+
color: #fff;
41+
padding: 10px 16px;
42+
border-radius: 4px;
43+
margin-bottom: 12px;
44+
font-size: 16px;
45+
font-weight: bold;
46+
">
47+
<span style="opacity:1"></span> <span style="opacity:0.4"></span> <span style="opacity:0.4"></span> &nbsp;&nbsp;Step 1 of 3: Answer the question
48+
</div>
49+
{{ pass }}
50+
3651
<div id="imessage">
3752
<p>This page is meant for you to use <i>after</i> the inclass peer instruction is over.
3853
<ol>
@@ -42,7 +57,7 @@ <h2>Peer Instruction Question (After Class)</h2>
4257
<li>Answer the question <strong>again.</strong> Even if you are not changing your answer from the first time.</li>
4358
</ol>
4459
</p>
45-
</div>
60+
</div>
4661

4762
<div class="row">
4863
{{ if all_done == "false": }}
@@ -105,6 +120,15 @@ <h3>Congratulations, you have completed this assignment!</h3>
105120
</div>
106121
</div>
107122
{{pass}}
123+
{{ if all_done == "false": }}
124+
<div class="col-md-12" style="text-align: right; margin-top: 10px; margin-bottom: 20px;">
125+
<form action="/peer/peer_async" style="display: inline;">
126+
<input type="hidden" name="assignment_id" value="{{=assignment_id}}" />
127+
<input type="hidden" name="question_num" value="{{=nextQnum}}" />
128+
<button type="submit" onclick="return checkVoteCount()" class="btn btn-default">{{ if is_last_question: }}Done{{ else: }}Next Question{{ pass }}</button>
129+
</form>
130+
</div>
131+
{{ pass }}
108132
</div>
109133
{{ if has_vote1 and has_reflection and llm_reply: }}
110134
<hr>
@@ -113,16 +137,6 @@ <h3>Congratulations, you have completed this assignment!</h3>
113137
<p>{{=llm_reply}}</p>
114138
</div>
115139
{{ pass }}
116-
117-
{{ if all_done == "false": }}
118-
<div>
119-
<form action="/peer/peer_async">
120-
<input type="hidden" name="assignment_id" value="{{=assignment_id}}" />
121-
<input type="hidden" name="question_num" value="{{=nextQnum}}" />
122-
<button type="submit" onclick="return checkVoteCount()" style="float: right; margin-bottom: 20px;">Next Question</button>
123-
</form>
124-
</div>
125-
{{ pass }}
126140
<script>
127141
window.DISABLE_ASYNC_EXPLAINER = true;
128142
</script>
@@ -157,6 +171,38 @@ <h3>Congratulations, you have completed this assignment!</h3>
157171
if (btn) btn.disabled = true;
158172
}
159173

174+
function updateStepBanner(step) {
175+
const banner = document.getElementById("stepBanner");
176+
if (!banner) return;
177+
banner.style.color = "#fff";
178+
var dots = function(filled) {
179+
var html = "";
180+
for (var i = 0; i < 3; i++) {
181+
var style = i < filled ? "opacity:1" : "opacity:0.4";
182+
html += '<span style="' + style + '">●</span> ';
183+
}
184+
return html;
185+
};
186+
var label;
187+
var bg;
188+
if (step === 1) {
189+
label = "Step 1 of 3: Answer the question";
190+
bg = "#4A9FDE";
191+
} else if (step === 2) {
192+
label = "Step 2 of 3: Explain your answer and discuss";
193+
bg = "#2878B5";
194+
} else if (step === 3) {
195+
label = "Step 3 of 3: Vote again — you may keep or change your answer";
196+
bg = "#1A5276";
197+
} else if (step === 4) {
198+
var hasNextQ = document.querySelector('form[action="/peer/peer_async"]');
199+
label = hasNextQ ? "Done! Move to the next question." : "Done! You have completed this assignment.";
200+
bg = "#0E3D56";
201+
}
202+
banner.innerHTML = dots(step > 3 ? 3 : step) + "&nbsp;&nbsp;" + label;
203+
banner.style.background = bg;
204+
}
205+
160206
function setReflectionPanelEnabled(enabled) {
161207
const panel = document.getElementById("reflectionPanel");
162208
if (!panel) return;
@@ -174,6 +220,7 @@ <h3>Congratulations, you have completed this assignment!</h3>
174220
alert("Please submit your first vote before voting again.");
175221
return;
176222
}
223+
updateStepBanner(3);
177224

178225
window._vote2Enabled = true;
179226
window._vote1Locked = false;
@@ -631,6 +678,7 @@ <h3>Congratulations, you have completed this assignment!</h3>
631678
if (studentVoteCount === 1 && !window._vote2Enabled) {
632679
hasVote1 = true;
633680
console.log("vote 1 submitted");
681+
updateStepBanner(2);
634682

635683
const vote2Btn = document.getElementById("readyVote2Btn");
636684
if (vote2Btn) {
@@ -648,6 +696,7 @@ <h3>Congratulations, you have completed this assignment!</h3>
648696
studentVoteCount = 2;
649697
studentSubmittedVote2 = true;
650698
window._vote2Enabled = false;
699+
updateStepBanner(4);
651700
}
652701
if (studentSubmittedVote2) {
653702
try {

0 commit comments

Comments
 (0)