Created
December 8, 2010 00:15
-
-
Save jessedearing/732688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.days_with_weekends.map do |day| | |
# time = {:day => day.to_datetime.utc.to_time.to_i} | |
time = {:day => day.to_datetime.utc} | |
if Date.today > day | |
if !hours_log[day].nil? | |
hours_in_sprint += hours_log[day] | |
end | |
burndown_data << time.merge({:hours => hours_in_sprint}) | |
elsif day == Date.today | |
burndown_data << time.merge({:hours => self.total_task_hours}) | |
elsif Date.today < day | |
burndown_data << time.merge({:hours => nil}) | |
end | |
hrs = {:hours => day == Date.today ? self.total_task_hours : hours_in_sprint} | |
end | |
burndown_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.days.each do |day| | |
if day == self.begin_date.to_date # sprint begin date, set to committed hours | |
hours_cache = self.committed_task_hours | |
elsif day == Time.zone.now.to_date # today, set to total hours | |
hours_cache = self.total_task_hours | |
else | |
hours_cache = self.committed_task_hours | |
day_exists_in_hours_log = !(hours_log.find {|h| h[:day] == day}).nil? | |
if day_exists_in_hours_log | |
hours_log.each do |log| | |
if log[:day] > day | |
hours_cache += log[:hours] | |
end | |
end | |
else | |
hours_cache = nil if day > Time.zone.now.to_date | |
end | |
end | |
burndown_data.push({:day => day.to_datetime.utc.to_time, :hours => hours_cache}) | |
end | |
burndown_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment