mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-16 09:16:32 +01:00
Simple dependency handling working on project page.
The database contains actions with dependencies. Please rename to tracks-17-blank.db or update database path accordingly. Conflicts: app/views/todos/toggle_check.js.rjs
This commit is contained in:
parent
cb4ed7ff7f
commit
101df3fb6b
4 changed files with 26 additions and 6 deletions
|
|
@ -144,19 +144,25 @@ class TodosController < ApplicationController
|
|||
|
||||
if @todo.completed?
|
||||
logger.debug "completed #{@todo.description}"
|
||||
# A todo was completed - check for pending todos
|
||||
# A todo was completed - check for pending todos to activate
|
||||
@pending_to_activate = []
|
||||
@todo.successors.each do |t|
|
||||
if t.uncompleted_predecessors.empty? # Activate pending todos
|
||||
logger.debug "activated #{t.description}"
|
||||
t.activate!
|
||||
@pending_to_activate << t
|
||||
end
|
||||
end
|
||||
else
|
||||
# Block todos for undone actions - (it does no harm if they are already pending)
|
||||
# Block active successors for undone action
|
||||
@active_to_block = []
|
||||
logger.debug "undid #{@todo.description}"
|
||||
@todo.successors.each do |t|
|
||||
logger.debug "blocked #{t.description}"
|
||||
t.block!
|
||||
if t.state == 'active'
|
||||
logger.debug "blocked #{t.description}"
|
||||
t.block!
|
||||
@active_to_block << t
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue