diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index b48488fb8..c94f734e1 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -164,6 +164,7 @@ class OrganizationsController < ApplicationController return end q = params[:search].nil? ? "" : "#{params[:search].strip}" + @field = OrgSubfield.find(params[:org_subfield_id]) @type = params[:type] if @type == "courses" || @type.nil? @org_teachers = 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 diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 882892822..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).first(5) + 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 diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 3fe57d223..4340213a4 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -102,7 +102,7 @@ <% end %> <% else %> <% if field.field_type == "Comptec" %> - <%= link_to "#{field.name}", teachers_organization_path(organization), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% else %> <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% end %> diff --git a/app/views/organizations/_org_subfield_rightM2.html.erb b/app/views/organizations/_org_subfield_rightM2.html.erb index 7a2003629..63abb8d51 100644 --- a/app/views/organizations/_org_subfield_rightM2.html.erb +++ b/app/views/organizations/_org_subfield_rightM2.html.erb @@ -5,7 +5,7 @@ <% excellent_teachers.each do |teacher| %>