From 8e3d1b694ab47317638b474082cb70e08a8d02e7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 13 Mar 2010 14:56:49 +0000 Subject: Adds subtasking (#443) including: * priority, start/due dates, progress, estimate, spent time roll-up to parent issues * descendant issues tree displayed on the issue view with context menu support * issue tree display on the gantt chart * issue tree copy on project copy * unlimited nesting Defining subtasks requires the new permission 'Manage subtasks'. Subtasks can not belong to a different project than the parent task. Implementation is based on scoped nested sets for fast reads and updates. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3573 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/timelog_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/controllers/timelog_controller.rb') diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index c08815890..160c19974 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -94,7 +94,7 @@ class TimelogController < ApplicationController elsif @issue.nil? sql_condition = @project.project_condition(Setting.display_subprojects_issues?) else - sql_condition = "#{TimeEntry.table_name}.issue_id = #{@issue.id}" + sql_condition = "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" end sql = "SELECT #{sql_select}, tyear, tmonth, tweek, spent_on, SUM(hours) AS hours" @@ -166,7 +166,7 @@ class TimelogController < ApplicationController elsif @issue.nil? cond << @project.project_condition(Setting.display_subprojects_issues?) else - cond << ["#{TimeEntry.table_name}.issue_id = ?", @issue.id] + cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" end retrieve_date_range @@ -176,7 +176,7 @@ class TimelogController < ApplicationController respond_to do |format| format.html { # Paginate results - @entry_count = TimeEntry.count(:include => :project, :conditions => cond.conditions) + @entry_count = TimeEntry.count(:include => [:project, :issue], :conditions => cond.conditions) @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] @entries = TimeEntry.find(:all, :include => [:project, :activity, :user, {:issue => :tracker}], @@ -184,7 +184,7 @@ class TimelogController < ApplicationController :order => sort_clause, :limit => @entry_pages.items_per_page, :offset => @entry_pages.current.offset) - @total_hours = TimeEntry.sum(:hours, :include => :project, :conditions => cond.conditions).to_f + @total_hours = TimeEntry.sum(:hours, :include => [:project, :issue], :conditions => cond.conditions).to_f render :layout => !request.xhr? } -- cgit v1.2.3