mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 15:50:13 +01:00
Projects with completed actions may be blocked
Currently, a project cannot be blocked if at least one completed
action exists. This was introduced in
acab98d4c7,
and I assume this change was not intended
This commit is contained in:
parent
ebec4f089d
commit
67ced62096
2 changed files with 4 additions and 2 deletions
|
|
@ -109,7 +109,7 @@ class Project < ActiveRecord::Base
|
||||||
## mutually exclusive for stalled and blocked
|
## mutually exclusive for stalled and blocked
|
||||||
# blocked is uncompleted project with deferred or pending todos, but no next actions
|
# blocked is uncompleted project with deferred or pending todos, but no next actions
|
||||||
return false if self.completed?
|
return false if self.completed?
|
||||||
return !self.todos.deferred_or_blocked.empty? && self.todos.not_deferred_or_blocked.empty?
|
return !self.todos.deferred_or_blocked.empty? && self.todos.active.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def stalled?
|
def stalled?
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
def test_project_blocked
|
def test_project_blocked
|
||||||
p = users(:admin_user).projects.first
|
p = users(:admin_user).projects.first
|
||||||
todo_in_other_project = users(:admin_user).projects.last.todos.first
|
|
||||||
|
|
||||||
assert !p.blocked?, "first project should not be blocked"
|
assert !p.blocked?, "first project should not be blocked"
|
||||||
|
|
||||||
|
|
@ -208,6 +207,9 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
p.activate!
|
p.activate!
|
||||||
p.todos.each{|t| t.show_from = 2.weeks.from_now; t.save! }
|
p.todos.each{|t| t.show_from = 2.weeks.from_now; t.save! }
|
||||||
assert p.blocked?, "projects with deferred todos should be blocked"
|
assert p.blocked?, "projects with deferred todos should be blocked"
|
||||||
|
|
||||||
|
p.todos.first.complete!
|
||||||
|
assert p.blocked?, "projects with deferred todo should be blocked even if a completed todo exists"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_project_stalled
|
def test_project_stalled
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue