Fixed another edge case that Luis caught

Thanks for testing!
This commit is contained in:
Eric Allen 2009-12-01 23:39:07 -05:00
parent c4ef04af4d
commit 9fa5ead8de
2 changed files with 10 additions and 0 deletions

View file

@ -368,10 +368,12 @@ class TodosController < ApplicationController
# activate successors if they only depend on this todo
activated_successor_count = 0
@pending_to_activate = []
@todo.pending_successors.each do |successor|
successor.uncompleted_predecessors.delete(@todo)
if successor.uncompleted_predecessors.empty?
successor.activate!
@pending_to_activate << successor
activated_successor_count += 1
end
end

View file

@ -23,6 +23,14 @@ if @saved
end
end
end
# Activate pending todos that are successors of the deleted
@pending_to_activate.each do |t|
logger.debug "#300: Removing #{t.description} from pending block and adding it to active"
page[t].remove if source_view_is(:project) or source_view_is(:tag)
page.insert_html :bottom, item_container_id(t), :partial => 'todos/todo', :locals => { :todo => t, :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(t, 'line'), {'startcolor' => "'#99ff99'", :duration => 2}
end
else
page.notify :error, "There was an error deleting the item #{@todo.description}", 8.0
end