分组作业和普通作业列表的排序

dev_hss
cxt 5 years ago
parent e99fd89b68
commit 1744ab6cb4

@ -82,7 +82,9 @@ class HomeworkCommonsController < ApplicationController
end end
@task_count = @homework_commons.size @task_count = @homework_commons.size
@homework_commons = @homework_commons.order("position DESC").page(page).per(15) order_str = @homework_type == 4 ? "position DESC" : "IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
homework_commons.created_at DESC"
@homework_commons = @homework_commons.order(order_str).page(page).per(15)
if @homework_type == 4 if @homework_type == 4
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns) @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns)

Loading…
Cancel
Save