Append Q to template id for Qatar courses

Courses taught in Qatar use a different template than their Canadian
counterparts. Append the letter Q to the template id of Qatar courses.
Normalize how template id is derived

The processed_courses view uses two different methods to derive
template ids, which have a potential to produce different results.
Change to use the same method in both places in the function.
Use existing template id instead of recalculating

The processed_courses view calculates template id twice. Use the first
calculated value instead of recalculating.
Check for org property before accessing

When checking for whether a course belongs to Qatar, ensure that the
course document has an org property before trying to access it.