From c5bccf1adbfedfbd03c522b8e5863d3a57d7e723 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 7 Jun 2016 16:02:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81=E6=8C=89?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 4 +-- app/helpers/organizations_helper.rb | 32 ++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index ef11dc9da..b247f5a41 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -105,9 +105,9 @@ class OrganizationsController < ApplicationController end # 最新动态, 来自我关联的项目和课程 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 + @acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'News', 'Message', 'Issue', 'JournalsForMessage') and ((container_type = 'Course' and container_id in (#{course_ids.join(',')})) or (container_type = 'Project' and container_id in (#{project_ids.join(',')}))) - order by created_at desc limit 6;") + order by updated_at desc limit 6;") end render :layout => 'base_org_custom' else diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index c523ec287..181dfccb9 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -66,52 +66,52 @@ module OrganizationsHelper def org_user_by_type obj case obj.act_type when "Message" - user = obj.act.author + obj.act.author when "News" - user = obj.act.author + obj.act.author when "HomeworkCommon" - user = obj.act.user + obj.act.user when "Issue" - user = obj.act.author + obj.act.author end end def org_title_by_type obj case obj.act_type when "Message" - user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject + obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject when "News" - user = obj.act.title + obj.act.title when "HomeworkCommon" - user = obj.act.name + obj.act.name when "Issue" - user = obj.act.subject + obj.act.subject end end def org_content_by_type obj case obj.act_type when "Message" - user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content + obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content when "News" - user = obj.act.description + obj.act.description when "HomeworkCommon" - user = obj.act.description + obj.act.description when "Issue" - user = obj.act.description + obj.act.description end end def org_time_by_type obj case obj.act_type when "Message" - time = obj.act.updated_on + obj.act.updated_on when "News" - user = obj.act.created_on + obj.act.created_on when "HomeworkCommon" - user = obj.act.updated_at + obj.act.updated_at when "Issue" - user = obj.act.updated_on + obj.act.updated_on end end