@ -49,8 +49,11 @@ module Redmine
end
module ClassMethods
# Time 2015-01-27 13:37:41
# Author lizanle
# Description 应该保持原来的写法更加容易懂
# Returns events of type event_type visible by user that occured between from and to
def find_events ( event_type , user , days , created_time , options )
def find_events ( 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?
@ -91,6 +94,10 @@ module Redmine
ActiveSupport :: Deprecation . warn " acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{ self . name } model or use explicit :permission option. "
scope = scope . scoped ( :conditions = > Project . allowed_to_condition ( user , " view_ #{ self . name . underscore . pluralize } " . to_sym , options ) )
end
# Time 2015-01-27 13:34:40
# Author lizanle
# Description 这段代码增加了时间跨度,时间跨度应该由管理员来调整,所以应该去掉
= begin
unless scope . all ( provider_options [ :find_options ] . dup ) . first . nil?
if provider_options [ :timestamp ] . include? " updated_on "
to = scope . scoped ( :order = > " #{ provider_options [ :timestamp ] } desc " ) . all ( provider_options [ :find_options ] . dup ) . first . updated_on
@ -100,9 +107,10 @@ module Redmine
if options [ :course ]
from = ( to - days . days ) > created_time ? ( to - days . days ) : created_time . to_date
else
from = to - days . day s - 1 . years
from = to - days . day - 1 . years
end
end
= end
if from && to
scope = scope . scoped ( :conditions = > [ " #{ provider_options [ :timestamp ] } BETWEEN ? AND ? " , from , to ] )