diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 6463bf854..27f24ebd0 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -183,7 +183,8 @@ module OrganizationsHelper end def excellent_teachers - User.where("excellent_teacher =?",true) + User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count + from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 order by course_count desc") end end