I would suggest factoring out a method to get the StudentModule.  Down through the find call.  It will simplify the logic in this method and the find_attempted method below.  (And it's used one other place?  I don't remember....)