Skip to content

Commit f6e1af6

Browse files
committed
fix bug where question counter going past last question of sync PI
1 parent 271e41e commit f6e1af6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • bases/rsptx/web2py_server/applications/runestone/controllers

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ def _get_current_question(assignment_id, get_next):
174174
idx = 0
175175
db(db.assignments.id == assignment_id).update(current_index=idx)
176176
elif get_next is True:
177-
idx = assignment.current_index + 1
177+
all_questions = _get_assignment_questions(assignment_id)
178+
total_questions = len(all_questions)
179+
idx = min(assignment.current_index + 1, max(total_questions - 1, 0))
178180
db(db.assignments.id == assignment_id).update(current_index=idx)
179181
else:
180182
idx = assignment.current_index

0 commit comments

Comments
 (0)