Fix has_many conditions wich didn't work when doing joins and includes.
Add nice api to get course completion stats.