@@ -382,11 +382,18 class ProjectsController < ApplicationController | |||||
382 |
|
382 | |||
383 | @events = [] |
|
383 | @events = [] | |
384 | @project.issues_with_subprojects(@with_subprojects) do |
|
384 | @project.issues_with_subprojects(@with_subprojects) do | |
|
385 | # Issues that have start and due dates | |||
385 | @events += Issue.find(:all, |
|
386 | @events += Issue.find(:all, | |
386 | :order => "start_date, due_date", |
|
387 | :order => "start_date, due_date", | |
387 | :include => [:tracker, :status, :assigned_to, :priority, :project], |
|
388 | :include => [:tracker, :status, :assigned_to, :priority, :project], | |
388 | :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] |
|
389 | :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] | |
389 | ) unless @selected_tracker_ids.empty? |
|
390 | ) unless @selected_tracker_ids.empty? | |
|
391 | # Issues that don't have a due date but that are assigned to a version with a date | |||
|
392 | @events += Issue.find(:all, | |||
|
393 | :order => "start_date, effective_date", | |||
|
394 | :include => [:tracker, :status, :assigned_to, :priority, :project, :fixed_version], | |||
|
395 | :conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] | |||
|
396 | ) unless @selected_tracker_ids.empty? | |||
390 | @events += Version.find(:all, :include => :project, |
|
397 | @events += Version.find(:all, :include => :project, | |
391 | :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to]) |
|
398 | :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to]) | |
392 | end |
|
399 | end |
@@ -230,6 +230,12 class Issue < ActiveRecord::Base | |||||
230 | relations.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.other_issue(self)} |
|
230 | relations.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.other_issue(self)} | |
231 | end |
|
231 | end | |
232 |
|
232 | |||
|
233 | # Returns the due date or the target due date if any | |||
|
234 | # Used on gantt chart | |||
|
235 | def due_before | |||
|
236 | due_date || (fixed_version ? fixed_version.effective_date : nil) | |||
|
237 | end | |||
|
238 | ||||
233 | def duration |
|
239 | def duration | |
234 | (start_date && due_date) ? due_date - start_date : 0 |
|
240 | (start_date && due_date) ? due_date - start_date : 0 | |
235 | end |
|
241 | end |
@@ -124,9 +124,9 pdf.SetFontStyle('B',7) | |||||
124 |
|
124 | |||
125 | if i.is_a? Issue |
|
125 | if i.is_a? Issue | |
126 | i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) |
|
126 | i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) | |
127 |
i_end_date = (i.due_ |
|
127 | i_end_date = (i.due_before <= @date_to ? i.due_before : @date_to ) | |
128 |
|
128 | |||
129 |
i_done_date = i.start_date + ((i.due_ |
|
129 | i_done_date = i.start_date + ((i.due_before - i.start_date+1)*i.done_ratio/100).floor | |
130 | i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) |
|
130 | i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) | |
131 | i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) |
|
131 | i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) | |
132 |
|
132 |
@@ -166,9 +166,9 top = headers_height + 10 | |||||
166 | @events.each do |i| |
|
166 | @events.each do |i| | |
167 | if i.is_a? Issue |
|
167 | if i.is_a? Issue | |
168 | i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) |
|
168 | i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) | |
169 |
i_end_date = (i.due_ |
|
169 | i_end_date = (i.due_before <= @date_to ? i.due_before : @date_to ) | |
170 |
|
170 | |||
171 |
i_done_date = i.start_date + ((i.due_ |
|
171 | i_done_date = i.start_date + ((i.due_before - i.start_date+1)*i.done_ratio/100).floor | |
172 | i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) |
|
172 | i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) | |
173 | i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) |
|
173 | i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) | |
174 |
|
174 |
@@ -13,6 +13,8 issues_001: | |||||
13 | assigned_to_id: |
|
13 | assigned_to_id: | |
14 | author_id: 2 |
|
14 | author_id: 2 | |
15 | status_id: 1 |
|
15 | status_id: 1 | |
|
16 | start_date: <%= 1.day.ago.to_date.to_s(:db) %> | |||
|
17 | due_date: <%= 10.day.from_now.to_date.to_s(:db) %> | |||
16 | issues_002: |
|
18 | issues_002: | |
17 | created_on: 2006-07-19 21:04:21 +02:00 |
|
19 | created_on: 2006-07-19 21:04:21 +02:00 | |
18 | project_id: 1 |
|
20 | project_id: 1 | |
@@ -20,13 +22,15 issues_002: | |||||
20 | priority_id: 5 |
|
22 | priority_id: 5 | |
21 | subject: Add ingredients categories |
|
23 | subject: Add ingredients categories | |
22 | id: 2 |
|
24 | id: 2 | |
23 | fixed_version_id: |
|
25 | fixed_version_id: 2 | |
24 | category_id: |
|
26 | category_id: | |
25 | description: Ingredients of the recipe should be classified by categories |
|
27 | description: Ingredients of the recipe should be classified by categories | |
26 | tracker_id: 2 |
|
28 | tracker_id: 2 | |
27 | assigned_to_id: 3 |
|
29 | assigned_to_id: 3 | |
28 | author_id: 2 |
|
30 | author_id: 2 | |
29 | status_id: 2 |
|
31 | status_id: 2 | |
|
32 | start_date: <%= 2.day.ago.to_date.to_s(:db) %> | |||
|
33 | due_date: | |||
30 | issues_003: |
|
34 | issues_003: | |
31 | created_on: 2006-07-19 21:07:27 +02:00 |
|
35 | created_on: 2006-07-19 21:07:27 +02:00 | |
32 | project_id: 1 |
|
36 | project_id: 1 |
@@ -14,7 +14,7 versions_002: | |||||
14 | updated_on: 2006-07-19 21:00:33 +02:00 |
|
14 | updated_on: 2006-07-19 21:00:33 +02:00 | |
15 | id: 2 |
|
15 | id: 2 | |
16 | description: Stable release |
|
16 | description: Stable release | |
17 | effective_date: 2006-07-19 |
|
17 | effective_date: <%= 20.day.from_now.to_date.to_s(:db) %> | |
18 | versions_003: |
|
18 | versions_003: | |
19 | created_on: 2006-07-19 21:00:33 +02:00 |
|
19 | created_on: 2006-07-19 21:00:33 +02:00 | |
20 | name: "2.0" |
|
20 | name: "2.0" |
@@ -259,7 +259,16 class ProjectsControllerTest < Test::Unit::TestCase | |||||
259 | get :gantt, :id => 1 |
|
259 | get :gantt, :id => 1 | |
260 | assert_response :success |
|
260 | assert_response :success | |
261 | assert_template 'gantt.rhtml' |
|
261 | assert_template 'gantt.rhtml' | |
262 |
|
|
262 | events = assigns(:events) | |
|
263 | assert_not_nil events | |||
|
264 | # Issue with start and due dates | |||
|
265 | i = Issue.find(1) | |||
|
266 | assert_not_nil i.due_date | |||
|
267 | assert events.include?(Issue.find(1)) | |||
|
268 | # Issue with without due date but targeted to a version with date | |||
|
269 | i = Issue.find(2) | |||
|
270 | assert_nil i.due_date | |||
|
271 | assert events.include?(i) | |||
263 | end |
|
272 | end | |
264 |
|
273 | |||
265 | def test_gantt_with_subprojects_should_not_show_private_subprojects |
|
274 | def test_gantt_with_subprojects_should_not_show_private_subprojects |
@@ -22,7 +22,7 require 'versions_controller' | |||||
22 | class VersionsController; def rescue_action(e) raise e end; end |
|
22 | class VersionsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class VersionsControllerTest < Test::Unit::TestCase |
|
24 | class VersionsControllerTest < Test::Unit::TestCase | |
25 | fixtures :projects, :versions, :users, :roles, :members, :enabled_modules |
|
25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = VersionsController.new |
|
28 | @controller = VersionsController.new | |
@@ -60,9 +60,9 class VersionsControllerTest < Test::Unit::TestCase | |||||
60 |
|
60 | |||
61 | def test_destroy |
|
61 | def test_destroy | |
62 | @request.session[:user_id] = 2 |
|
62 | @request.session[:user_id] = 2 | |
63 |
post :destroy, :id => |
|
63 | post :destroy, :id => 3 | |
64 | assert_redirected_to 'projects/settings/ecookbook' |
|
64 | assert_redirected_to 'projects/settings/ecookbook' | |
65 |
assert_nil Version.find_by_id( |
|
65 | assert_nil Version.find_by_id(3) | |
66 | end |
|
66 | end | |
67 |
|
67 | |||
68 | def test_issue_status_by |
|
68 | def test_issue_status_by |
General Comments 0
You need to be logged in to leave comments.
Login now