##// END OF EJS Templates
Fixes progress calculation on gantt (#7838)....
Jean-Philippe Lang -
r5116:86eed08fbf49
parent child
Show More
@@ -639,10 +639,10 module Redmine
639 end
639 end
640
640
641 if progress
641 if progress
642 progress_date = start_date + (end_date - start_date) * (progress / 100.0)
642 progress_date = start_date + (end_date - start_date + 1) * (progress / 100.0)
643 if progress_date > self.date_from && progress_date > start_date
643 if progress_date > self.date_from && progress_date > start_date
644 if progress_date < self.date_to
644 if progress_date < self.date_to
645 coords[:bar_progress_end] = progress_date - self.date_from + 1
645 coords[:bar_progress_end] = progress_date - self.date_from
646 else
646 else
647 coords[:bar_progress_end] = self.date_to - self.date_from + 1
647 coords[:bar_progress_end] = self.date_to - self.date_from + 1
648 end
648 end
@@ -547,9 +547,9 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
547 assert_select "div.version.task_done[style*=left:28px]", true, @response.body
547 assert_select "div.version.task_done[style*=left:28px]", true, @response.body
548 end
548 end
549
549
550 should "Be the total done width of the version" do
550 should "be the total done width of the version" do
551 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4})
551 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4})
552 assert_select "div.version.task_done[style*=width:18px]", true, @response.body
552 assert_select "div.version.task_done[style*=width:16px]", true, @response.body
553 end
553 end
554 end
554 end
555
555
@@ -707,9 +707,10 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
707 assert_select "div.task_done[style*=left:28px]", true, @response.body
707 assert_select "div.task_done[style*=left:28px]", true, @response.body
708 end
708 end
709
709
710 should "Be the total done width of the issue" do
710 should "be the total done width of the issue" do
711 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
711 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
712 assert_select "div.task_done[style*=width:18px]", true, @response.body
712 # 15 days * 4 px * 30% - 2 px for borders = 16 px
713 assert_select "div.task_done[style*=width:16px]", true, @response.body
713 end
714 end
714
715
715 should "not be the total done width if the chart starts after issue start date" do
716 should "not be the total done width if the chart starts after issue start date" do
@@ -717,7 +718,24 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
717
718
718 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
719 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
719 assert_select "div.task_done[style*=left:0px]", true, @response.body
720 assert_select "div.task_done[style*=left:0px]", true, @response.body
720 assert_select "div.task_done[style*=width:10px]", true, @response.body
721 assert_select "div.task_done[style*=width:8px]", true, @response.body
722 end
723
724 context "for completed issue" do
725 setup do
726 @issue.done_ratio = 100
727 end
728
729 should "be the total width of the issue" do
730 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
731 assert_select "div.task_done[style*=width:58px]", true, @response.body
732 end
733
734 should "be the total width of the issue with due_date=start_date" do
735 @issue.due_date = @issue.start_date
736 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
737 assert_select "div.task_done[style*=width:2px]", true, @response.body
738 end
721 end
739 end
722 end
740 end
723
741
General Comments 0
You need to be logged in to leave comments. Login now