From db3e8616c89ba34196fd12eafb3680df9479a024 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 18 Mar 2007 10:17:59 +0000 Subject: [PATCH] better rendering time for projects/calendar git-svn-id: http://redmine.rubyforge.org/svn/trunk@343 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 7 ++++++- app/views/projects/calendar.rhtml | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f02a0e1e6..8feb5f5de 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -519,7 +519,12 @@ class ProjectsController < ApplicationController # finish on sunday @date_to = @date_to + (7-@date_to.cwday) - @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to]) + @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], + :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to]) + + @ending_issues_by_days = @issues.group_by {|issue| issue.due_date} + @starting_issues_by_days = @issues.group_by {|issue| issue.start_date} + render :layout => false if request.xhr? end diff --git a/app/views/projects/calendar.rhtml b/app/views/projects/calendar.rhtml index 154c5618a..8db92a938 100644 --- a/app/views/projects/calendar.rhtml +++ b/app/views/projects/calendar.rhtml @@ -43,9 +43,7 @@ while day <= @date_to <% end %> " style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>">

<%= day==Date.today ? "#{day.day}" : day.day %>

- <% day_issues = [] - @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day } - day_issues.each do |i| %> + <% ((@ending_issues_by_days[day] || []) + (@starting_issues_by_days[day] || [])).uniq.each do |i| %>
<%= if day == i.start_date and day == i.due_date image_tag('arrow_bw.png') -- 2.39.5