def backlog_graph

@project = Project.find(params[:id], :include => {:assignments => :employee})
@assignments = @project.assignments.collect
#cool, so right now we have the project and all of its assignments. Let's create an array that holds each day's value (initialized to 0)

backlog = - @project.start_date).to_i), 0)

#the first value in the array will be the full value of the project
burn_carry = @project.mswa_value
backlog[0] = burn_carry
i = 1

#now we'll iterate through each day and collect every assignment's data, if the assignment is active during that day

backlog.each do |day|
day_burn = 0 #day's total burn
current_day = @project.start_date.advance(:days => i)

@assignments.each do |assignment|
if (assignment.start_date..assignment.end_date).to_a.include?(current_day){
day_burn += assignment.daily_burn # we're adding the cost of that assignment (which is returned by the daily_burn method in the assignment model)

backlog[i] = burn_carry-day_burn
burn_carry = backlog[i] #this value will be used by the next iteration to decrease the total backlog

i = i + 1

## backlog is then used to feed the graphing utility