ziafazal/api-fix-duplicats-on-cohort-page:fixed duplicates when user is enrolled in more than one course

@mattdrayer @martynjames fixed a bug which was causing duplicates in course metrics and time series apis.