按名字排序没有过滤搜索条件

This commit is contained in:
sw 2015-06-19 14:59:28 +08:00
parent 86dc66ebeb
commit a72bbee503
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class StudentWorkController < ApplicationController
if @show_all
if @homework.homework_type == 1 || @is_teacher || User.current.admin?
if @order == "name"
@stundet_works = @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}")
@stundet_works = search_homework_member @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
else
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
end
@ -25,7 +25,7 @@ class StudentWorkController < ApplicationController
@stundet_works = []
else
if @order == "name"
@stundet_works = @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}")
@stundet_works = search_homework_member @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
else
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
end