课程列表按创建时间排序

This commit is contained in:
huang 2016-05-03 18:17:03 +08:00
parent d3e3e9d22b
commit 4489bc13d7
1 changed files with 1 additions and 1 deletions

View File

@ -2948,7 +2948,7 @@ class UsersController < ApplicationController
sort_name = "created_at"
sort_type = @c_sort == 1 ? "asc" : "desc"
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a #{sort_type}")
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a #{sort_type}")
#根据 作业+资源数排序
if @order.to_i == 2