我发布的作业,过滤后按创建时间倒序
This commit is contained in:
parent
17bdb053bc
commit
c34812f8a3
|
@ -1842,11 +1842,11 @@ end
|
|||
if params[:property]
|
||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||
if params[:property] == "1"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1 order by created_at desc")
|
||||
elsif params[:property] == "2"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2 order by created_at desc")
|
||||
elsif params[:property] == "3"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3 order by created_at desc")
|
||||
end
|
||||
end
|
||||
@limit = 10
|
||||
|
|
Loading…
Reference in New Issue