最新动态按创建时间排序

This commit is contained in:
huang 2016-06-08 11:36:32 +08:00
parent 388e862241
commit 90aaaa544a
2 changed files with 5 additions and 5 deletions

View File

@ -107,7 +107,7 @@ class OrganizationsController < ApplicationController
if @organization.org_subfields.where(:field_type => "Compact", :hide => 0).count > 0
@acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'News', 'Message', 'Issue') and
((container_type = 'Course' and container_id in (#{course_ids.join(',')})) or (container_type = 'Project' and container_id in (#{project_ids.join(',')})))
order by updated_at desc limit 6;")
order by created_at desc limit 6;")
end
render :layout => 'base_org_custom'
else
@ -273,7 +273,7 @@ class OrganizationsController < ApplicationController
course_ids = (@organization.courses.map(&:id) - shield_course_ids) << 0
@org_acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'News', 'Message', 'Issue') and
((container_type = 'Course' and container_id in (#{course_ids.join(',')})) or (container_type = 'Project' and container_id in (#{project_ids.join(',')})))
order by updated_at desc limit 6;")
order by created_at desc limit 6;")
respond_to do |format|
format.html{render :layout => 'base_org_custom'}
format.js

View File

@ -105,13 +105,13 @@ module OrganizationsHelper
def org_time_by_type obj
case obj.act_type
when "Message"
obj.act.updated_on
obj.act.created_on
when "News"
obj.act.created_on
when "HomeworkCommon"
obj.act.updated_at
obj.act.created_at
when "Issue"
obj.act.updated_on
obj.act.created_on
end
end