Fix issue where courses without team memberships display courses properl...

...y, consolidate course membership queries, fix leaderboard select bug