Split get_courses_for_wiki impl

LMS-2914
Why was line 1249 expanded to lines 1255-1259?  Perhaps its a matter of coding style, though I prefer the more succinct version.