Commit 8595ff79 authored by Felipe Artur's avatar Felipe Artur Committed by Mike Greiling

Show chart only until current date when milestone due date is bigger

parent d36d04f4
......@@ -2,11 +2,12 @@ class Burndown
attr_accessor :start_date, :end_date, :issues_count, :issues_weight
def initialize(milestone)
@milestone = milestone
@start_date = @milestone.start_date
@end_date = @milestone.due_date
@milestone = milestone
@start_date = @milestone.start_date
@end_date = @milestone.due_date
@end_date = Date.today if @end_date.present? && @end_date > Date.today
issues = @milestone.issues
issues = @milestone.issues
@issues_count = issues.count
@issues_weight = issues.sum(:weight)
......
......@@ -50,6 +50,12 @@ describe Burndown, models: true do
expect(subject).to eq([])
end
it "it counts until today if milestone due date > Date.today" do
Timecop.travel(milestone.due_date - 1.day)
expect(subject.last[0]).to eq(Time.now.strftime("%Y-%m-%d"))
end
# Creates, closes and reopens issues only for odd days numbers
def build_sample
milestone.start_date.upto(milestone.due_date) do |date|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment