MDL-55956 calendar: Include courses parameter in subquery conditions