mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-28 12:58:48 +01:00
#300: Updated todo fsm with guards that prevent activation if uncompleted predecessors exists
This commit is contained in:
parent
0276dce8e2
commit
ad953fe80b
1 changed files with 3 additions and 2 deletions
|
|
@ -43,8 +43,9 @@ class Todo < ActiveRecord::Base
|
|||
event :activate do
|
||||
transitions :to => :active, :from => [:project_hidden, :completed, :deferred]
|
||||
transitions :to => :active, :from => [:pending],
|
||||
:guard => Proc.new{|t| t.show_from.blank? or Time.zone.now > t.show_from}
|
||||
transitions :to => :deferred, :from => [:pending]
|
||||
:guard => Proc.new{|t| t.show_from.blank? or Time.zone.now > t.show_from and t.uncompleted_predecessors.empty?}
|
||||
transitions :to => :deferred, :from => [:pending],
|
||||
:guard => Proc.new{|t| t.uncompleted_predecessors.empty?}
|
||||
end
|
||||
|
||||
event :hide do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue