Okay, so I ended up looking through the code and found that this is a problem with using get_role_users() in your get_gradebook_users() function. What is happening is that this site has site wide Managers AND it also has that role set as a graded role since Managers also have to take the courses. So that function was returning all of them in the dropdown whether they were in the course or not, and for some reason, it was not getting the student role.
I think this is something you need to look at as it is a problem with using get_role_users when you have users in the course with more than one role or have a site wide role?
For now, just to get it to work, I hardcoded 5 in place of the $roleid.