diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 920dbd5e4..73d3ee05f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -472,15 +472,13 @@ class ProjectsController < ApplicationController @date_from = Date.civil(@year, @month, 1) @date_to = @date_from >> 1 - @events_by_day = {} + @events_by_day = Hash.new { |h,k| h[k] = [] } unless params[:show_issues] == "0" @project.issues.find(:all, :include => [:author], :conditions => ["#{Issue.table_name}.created_on BETWEEN ? AND ?", @date_from, @date_to] ).each { |i| - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @project.issue_changes.find(:all, :include => :details, :conditions => ["(#{Journal.table_name}.created_on BETWEEN ? AND ?) AND (#{JournalDetail.table_name}.prop_key = 'status_id')", @date_from, @date_to] ).each { |i| - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @show_issues = 1 @@ -488,7 +486,6 @@ class ProjectsController < ApplicationController unless params[:show_news] == "0" @project.news.find(:all, :conditions => ["#{News.table_name}.created_on BETWEEN ? AND ?", @date_from, @date_to], :include => :author ).each { |i| - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @show_news = 1 @@ -497,9 +494,8 @@ class ProjectsController < ApplicationController unless params[:show_files] == "0" Attachment.find(:all, :select => "#{Attachment.table_name}.*", :joins => "LEFT JOIN #{Version.table_name} ON #{Version.table_name}.id = #{Attachment.table_name}.container_id", - :conditions => ["#{Attachment.table_name}.container_type='Version' and #{Version.table_name}.project_id=? and #{Attachment.table_name}.created_on BETWEEN ? AND ?", @project.id, @date_from, @date_to], + :conditions => ["#{Attachment.table_name}.container_type='Version' and #{Version.table_name}.project_id=? and #{Attachment.table_name}.created_on BETWEEN ? AND ? ", @project.id, @date_from, @date_to], :include => :author ).each { |i| - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @show_files = 1 @@ -507,14 +503,12 @@ class ProjectsController < ApplicationController unless params[:show_documents] == "0" @project.documents.find(:all, :conditions => ["#{Document.table_name}.created_on BETWEEN ? AND ?", @date_from, @date_to] ).each { |i| - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN #{Document.table_name} ON #{Document.table_name}.id = #{Attachment.table_name}.container_id", - :conditions => ["#{Attachment.table_name}.container_type='Document' and #{Document.table_name}.project_id=? and #{Attachment.table_name}.created_on BETWEEN ? AND ?", @project.id, @date_from, @date_to], + :conditions => ["#{Attachment.table_name}.container_type='Document' and #{Document.table_name}.project_id=? and #{Attachment.table_name}.created_on BETWEEN ? AND ? ", @project.id, @date_from, @date_to], :include => :author ).each { |i| - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @show_documents = 1 @@ -533,8 +527,6 @@ class ProjectsController < ApplicationController def i.created_on self.updated_on end - - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @show_wiki_edits = 1 @@ -545,7 +537,6 @@ class ProjectsController < ApplicationController def i.created_on self.committed_on end - @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @show_changesets = 1