From 6c02c96342187e6cff562cab0dba4581570c043d Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 27 Jan 2015 13:39:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BA=86=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=B7=A8=E5=BA=A6=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/acts_as_activity_provider.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb b/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb index 17f834c84..f467ef873 100644 --- a/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb +++ b/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb @@ -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])