项目、课程列表增加更新时间

This commit is contained in:
yuanke 2016-05-03 17:57:24 +08:00
parent 96e7c9d134
commit 8b672cc7c3
4 changed files with 7 additions and 3 deletions

View File

@ -83,6 +83,8 @@ class NewsController < ApplicationController
sort_type = @b_sort == 1 ? "asc" : "desc"
#scope = News.find_by_sql("select a.*,b.updated_at from news a, course_activities b where a.course_id = 532 and a.course_id = b.course_id and b.course_act_id = a.id ) ")
scope = @course ? @course.news.course_visible : News.course_visible
news_arr = scope.map{|news| news.id}

View File

@ -2855,7 +2855,7 @@ class UsersController < ApplicationController
@c_sort = 2
end
sort_name = "created_at"
sort_name = "updated_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}")
@ -2899,10 +2899,10 @@ class UsersController < ApplicationController
@c_sort = 2
end
sort_name = "created_on"
sort_name = "updated_on"
sort_type = @c_sort == 1 ? "asc" : "desc"
@projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}")
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}")
#根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num
if @order.to_i == 2

View File

@ -30,6 +30,7 @@
<span class="grayTxt">
创建时间:<%= format_time(course.created_at) %>
</span>
<span class="grayTxt">更新时间:<%= format_time(course.updated_at) %></span>
<span class="grayTxt">
开课学期:&nbsp;&nbsp;<span><%= current_time_and_term course %></span>
</span>

View File

@ -27,6 +27,7 @@
<div class="cl"></div>
<li class="ml15">
<span class="grayTxt">创建时间:<%= format_time(project.created_on) %></span>
<span class="grayTxt">更新时间:<%= format_time(project.updated_on) %></span>
<p class="list-info fr grayTxt"><span><%= project.project_score.issue_num %></span><span>问题</span><span>|</span><span> <%= project.project_score.attach_num %></span><span>资源</span></p>
</li>
<div class="cl"></div>