diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-09-09 11:34:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-09-09 11:34:35 +0000 |
commit | 972a991a922e1dfe0de7474ec727e97408cf9dcc (patch) | |
tree | 78aac44a8656726f95ac5e9ba23cc7cd709971ee /app/models/mailer.rb | |
parent | 62d5b4c7108d8caa7d3a71e94d45088ca8aa257e (diff) | |
download | redmine-972a991a922e1dfe0de7474ec727e97408cf9dcc.tar.gz redmine-972a991a922e1dfe0de7474ec727e97408cf9dcc.zip |
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10337 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mailer.rb')
-rw-r--r-- | app/models/mailer.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb index b8b2ac721..65ca9ea08 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -334,15 +334,15 @@ class Mailer < ActionMailer::Base tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil user_ids = options[:users] - scope = Issue.open.scoped(:conditions => ["#{Issue.table_name}.assigned_to_id IS NOT NULL" + + scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" + " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" + - " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date] + " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date ) - scope = scope.scoped(:conditions => {:assigned_to_id => user_ids}) if user_ids.present? - scope = scope.scoped(:conditions => {:project_id => project.id}) if project - scope = scope.scoped(:conditions => {:tracker_id => tracker.id}) if tracker + scope = scope.where(:assigned_to_id => user_ids) if user_ids.present? + scope = scope.where(:project_id => project.id) if project + scope = scope.where(:tracker_id => tracker.id) if tracker - issues_by_assignee = scope.all(:include => [:status, :assigned_to, :project, :tracker]).group_by(&:assigned_to) + issues_by_assignee = scope.includes(:status, :assigned_to, :project, :tracker).all.group_by(&:assigned_to) issues_by_assignee.keys.each do |assignee| if assignee.is_a?(Group) assignee.users.each do |user| |