##// 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 639 end
640 640
641 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 643 if progress_date > self.date_from && progress_date > start_date
644 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 646 else
647 647 coords[:bar_progress_end] = self.date_to - self.date_from + 1
648 648 end
@@ -547,9 +547,9 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
547 547 assert_select "div.version.task_done[style*=left:28px]", true, @response.body
548 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 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 553 end
554 554 end
555 555
@@ -707,9 +707,10 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
707 707 assert_select "div.task_done[style*=left:28px]", true, @response.body
708 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 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 714 end
714 715
715 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 719 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
719 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 739 end
722 740 end
723 741
General Comments 0
You need to be logged in to leave comments. Login now