diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 1b328ad7e..c63cf8c7f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -238,23 +238,12 @@ class OrganizationsController < ApplicationController if @type.nil? @containers = Course.find_by_sql("SELECT * FROM `courses` where is_delete = 0 and is_public = 1 and name like '%#{q}%' order by updated_at desc;") elsif @type == "famous" - @containers = Course.find_by_sql("SELECT * FROM `courses` where is_delete = 0 and is_public = 1 and hot = 1 and name like '%#{q}%' order by updated_at desc;") + @containers = Course.find_by_sql("SELECT * FROM `courses` where is_delete = 0 and is_public = 1 and is_excellent = 1 and name like '%#{q}%' order by updated_at desc;") end atta_page_public @containers end def acts - q = params[:search].nil? ? "" : "#{params[:search].strip}" - @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id]) - @type = params[:type] - if @type == "courses" || @type.nil? - @org_students = User.find_by_sql("select u.*, ue.student_id, 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= 1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") - elsif @type == "famous" - @org_students = User.find_by_sql("select u.*, ue.student_id, 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= 1 and u.excellent_student =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") - end - atta_page_public container @containers end def searchmember_by_name members, name @@ -543,6 +532,18 @@ class OrganizationsController < ApplicationController end end + def update_field_by_admin + @type = params[:type] + @status = params[:status] + if @type == "project" + @container = Project.find(params[:container]) + @status == "reset" ? @container.update_column(:hot, 0) : @container.update_column(:hot, 1) + else + @container = Course.find(params[:container]) + @status == "reset" ? @container.update_column(:is_excellent, 0) : @container.update_column(:is_excellent, 1) + end + end + # 设置为名师 def set_excellent_teacher @ex_teacher = User.find(params[:user]) diff --git a/app/views/organizations/_org_container.html.erb b/app/views/organizations/_org_container.html.erb index 42c216879..59ac4d95c 100644 --- a/app/views/organizations/_org_container.html.erb +++ b/app/views/organizations/_org_container.html.erb @@ -16,24 +16,9 @@