MDL-42020 course: performance improvement in course listings

- better performance when get_course_count() OR search_course_count() are called by themselves
- better performance in displaying course contacts