添加注释,修改变量命名

This commit is contained in:
lizanle 2015-01-27 16:31:44 +08:00
parent 6c76cacb61
commit 475ef12cd5
1 changed files with 6 additions and 3 deletions

View File

@ -49,8 +49,11 @@ module Redmine
end end
module ClassMethods module ClassMethods
# Time 2015-01-27 16:30:47
# Author lizanle
# Description 用原来的写法from,to更加容易懂
# Returns events of type event_type visible by user that occured between from and to # 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] provider_options = activity_provider_options[event_type]
raise "#{self.name} can not provide #{event_type} events." if provider_options.nil? raise "#{self.name} can not provide #{event_type} events." if provider_options.nil?
@ -93,7 +96,7 @@ module Redmine
end end
# Time 2015-01-27 15:18:33 # Time 2015-01-27 15:18:33
# Author lizanle # Author lizanle
# Description 删除 unless scope.all因为这个执行查询并且没有加入时间限制与下边 scope.all(provider_options[:find_options].dup)重复查询 # Description 删除 unless scope.all因为这个执行查询并且没有加入时间限制与下边 scope.all(provider_options[:find_options].dup)重复
if options[:course] if options[:course]
if provider_options[:timestamp].include? "updated_on" if provider_options[:timestamp].include? "updated_on"
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.updated_on to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.updated_on
@ -102,7 +105,7 @@ module Redmine
end end
from = (to - days.days) > created_time ? (to - days.days) : created_time.to_date from = (to - days.days) > created_time ? (to - days.days) : created_time.to_date
else else
from = to - Setting.activity_days_default.to_i #from = to - Setting.activity_days_default.to_i
end end
if from && to if from && to