Undefined method levels

Fix this exception https://groups.google.com/forum/#!topic/coursemology/emUJJEohQ-Q
It is caused by a user, probably admin, trying to attempt an assessment of a course he's not enrolled. In this case, his UserCourse record can't be found so we were trying to access the levels property of nil.
Fixed by removing the attempt button if a user is not enrolled and redirect to the access denied page if he tries to access with url.
why don't check curr_user_course here ?