计算评论数量,修复按照时间查找bug,etc...
This commit is contained in:
parent
1ef5059708
commit
6cede3d2be
|
@ -47,6 +47,18 @@ module WelcomeHelper
|
|||
sort_contest_by_hot
|
||||
end
|
||||
|
||||
def cal_memos_count event
|
||||
return nil if event.parent_id
|
||||
event.replies_count
|
||||
rescue NoMethodError
|
||||
nil
|
||||
end
|
||||
|
||||
def cal_issues_count event
|
||||
event.journals.count
|
||||
rescue NoMethodError
|
||||
nil
|
||||
end
|
||||
|
||||
|
||||
def time_tag_welcome time
|
||||
|
|
|
@ -23,7 +23,8 @@ class Memo < ActiveRecord::Base
|
|||
:type => Proc.new {|o| o.parent_id.nil? ? 'Forum' : 'Memo'},
|
||||
:url => Proc.new {|o| {:controller => 'memos', :action => 'show', :forum_id => o.forum_id}.merge(o.parent_id.nil? ? {:id => o.id} : {:id => o.parent_id, :anchor => "reply-#{o.id}"})}
|
||||
acts_as_activity_provider :author_key => :author_id,
|
||||
:func => 'memos'
|
||||
:func => 'memos',
|
||||
:timestamp => 'created_at'
|
||||
# :find_options => {:type => 'memos'}
|
||||
# acts_as_watchable
|
||||
|
||||
|
|
|
@ -82,6 +82,9 @@ module Redmine
|
|||
scope.all(provider_options[:find_options].dup)
|
||||
end
|
||||
|
||||
# 为了首页获取数据基本复制了上面的方法,改变了用户查看权限,增加了对讨论区的识别。
|
||||
# 因为新建了讨论区的内容,没有与项目方法混合,但是 event_type 取值类型还在共用,可能会对项目活动取值性能造成影响
|
||||
# 不过鉴于项目参与查询的条件减少,而增加的时间没有可见增长,重写event_type 的类型需要设计到lib,暂时不做改动
|
||||
def find_events1(event_type, user, from, to, options)
|
||||
provider_options = activity_provider_options[event_type]
|
||||
raise "#{self.name} can not provide #{event_type} events." if provider_options.nil?
|
||||
|
|
Loading…
Reference in New Issue