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

Commit 068c507

Browse files
committed
New: Show completion message for peer async
1 parent 4c5ff59 commit 068c507

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

controllers/peer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,15 @@ def _get_numbered_question(assignment_id, qnum):
136136
a_qs = db(db.assignment_questions.assignment_id == assignment_id).select(
137137
orderby=[db.assignment_questions.sorting_priority, db.assignment_questions.id]
138138
)
139+
done = False
139140
if qnum > len(a_qs) - 1:
140141
qnum = len(a_qs) - 1
142+
done = True
141143

142144
current_question_id = a_qs[qnum].question_id
143145
current_question = db(db.questions.id == current_question_id).select().first()
144146

145-
return current_question
147+
return current_question, done
146148

147149

148150
def _get_lastn_answers(num_answer, div_id, course_name, start_time, end_time=None):
@@ -500,14 +502,15 @@ def peer_async():
500502
if request.vars.question_num:
501503
qnum = int(request.vars.question_num)
502504

503-
current_question = _get_numbered_question(assignment_id, qnum)
505+
current_question, all_done = _get_numbered_question(assignment_id, qnum)
504506

505507
return dict(
506508
course_id=auth.user.course_name,
507509
course=get_course_row(db.courses.ALL),
508510
current_question=current_question,
509511
assignment_id=assignment_id,
510512
nextQnum=qnum + 1,
513+
all_done=all_done,
511514
)
512515

513516

views/peer/peer_async.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ <h2>Peer Instruction Question (After Class)</h2>
2121
</div>
2222

2323
<div class="row">
24+
{{ if not all_done: }}
2425
<div class="oneq col-md-6">{{=XML(current_question['htmlsrc'])}}</div>
25-
26+
{{ else: }}
27+
<div class="oneq col-md-6">
28+
<h3>Congratulations, you have completed this assignment!</h3>
29+
</div>
30+
{{ pass }}
31+
{{ if not all_done: }}
2632
<div class="col-md-6">
2733
<p>
2834
Please provide an explanation for why you answered
@@ -37,16 +43,18 @@ <h4>A discussion for you to consider</h4>
3743
<p id="nextStep"></p>
3844
</div>
3945
</div>
46+
{{pass}}
4047
</div>
4148

49+
{{ if not all_done: }}
4250
<div>
4351
<form action="/peer/peer_async">
4452
<input type="hidden" name="assignment_id" value="{{=assignment_id}}" />
4553
<input type="hidden" name="question_num" value="{{=nextQnum}}" />
4654
<button type="submit" onclick="return checkVoteCount()">Next Question</button>
4755
</form>
4856
</div>
49-
57+
{{ pass }}
5058
<script src="/runestone/static/js/peer.js?v={{=request.peer_mtime}}"></script>
5159
<script>
5260
var user = "{{=auth.user.username}}";

0 commit comments

Comments
 (0)