Open jpslav opened 10 years ago
I believe that the next_student_exercise and friends are broken because student_assignment.student_exercises is not guaranteed to give those SEs in the correct order (though it likely is the case that they are normally returned in order).
student_assignment.student_exercises
Something more like this will work:
next_ae = @student_exercise.assignment_exercise.next next_se = next_ae.nil? ? nil : StudentExercise.where{student_assignment_id == my{@student_exercise.student_assignment_id}}.where{assignment_exercise_id == my{next_ae.id}}.first
I believe that the next_student_exercise and friends are broken because
student_assignment.student_exercises
is not guaranteed to give those SEs in the correct order (though it likely is the case that they are normally returned in order).Something more like this will work: