去掉了增加时间跨度的代码

This commit is contained in:
lizanle 2015-01-27 13:39:16 +08:00
parent b26f2029ef
commit 6c02c96342
1 changed files with 10 additions and 2 deletions

View File

@ -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.days - 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])