diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 92ee602b..c7909c94 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1190,9 +1190,9 @@ class CoursesController < ApplicationController @all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q) end - @homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC") - @exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC") - @tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC") + @homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc") + @exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc") + @tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc") respond_to do |format| format.xls {